summaryrefslogtreecommitdiff
path: root/.github/workflows/get-backend-memory.yml
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-12-03 16:02:49 +0900
committerGitHub <noreply@github.com>2025-12-03 16:02:49 +0900
commit0b77dc8c483ea8cbbb719679da3ca438d0d92535 (patch)
treefb99f81376a16621257063f183aa6e08ceaaae37 /.github/workflows/get-backend-memory.yml
parentadd DeepWiki badge to enable auto-refresh (diff)
downloadmisskey-0b77dc8c483ea8cbbb719679da3ca438d0d92535.tar.gz
misskey-0b77dc8c483ea8cbbb719679da3ca438d0d92535.tar.bz2
misskey-0b77dc8c483ea8cbbb719679da3ca438d0d92535.zip
Add backend memory usage comparison action for PRs (#16926)
* Initial plan * Add backend memory usage comparison action Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Fix deprecated serverProcess.killed usage Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Add explicit permissions to save-pr-number job Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Change PR comment text from Japanese to English Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Inline memory measurement script to fix base ref compatibility Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Revert "Inline memory measurement script to fix base ref compatibility" This reverts commit 6f76a121efd450c257167cce6e298c59936f4e37. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to '.github/workflows/get-backend-memory.yml')
-rw-r--r--.github/workflows/get-backend-memory.yml85
1 files changed, 85 insertions, 0 deletions
diff --git a/.github/workflows/get-backend-memory.yml b/.github/workflows/get-backend-memory.yml
new file mode 100644
index 0000000000..6f36c088f1
--- /dev/null
+++ b/.github/workflows/get-backend-memory.yml
@@ -0,0 +1,85 @@
+# this name is used in report-backend-memory.yml so be careful when change name
+name: Get backend memory usage
+
+on:
+ pull_request:
+ branches:
+ - master
+ - develop
+ paths:
+ - packages/backend/**
+ - packages/misskey-js/**
+ - .github/workflows/get-backend-memory.yml
+
+jobs:
+ get-memory-usage:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+
+ strategy:
+ matrix:
+ memory-json-name: [memory-base.json, memory-head.json]
+ include:
+ - memory-json-name: memory-base.json
+ ref: ${{ github.base_ref }}
+ - memory-json-name: memory-head.json
+ ref: refs/pull/${{ github.event.number }}/merge
+
+ services:
+ postgres:
+ image: postgres:18
+ ports:
+ - 54312:5432
+ env:
+ POSTGRES_DB: test-misskey
+ POSTGRES_HOST_AUTH_METHOD: trust
+ redis:
+ image: redis:7
+ ports:
+ - 56312:6379
+
+ steps:
+ - uses: actions/checkout@v4.3.0
+ with:
+ ref: ${{ matrix.ref }}
+ submodules: true
+ - name: Setup pnpm
+ uses: pnpm/action-setup@v4.2.0
+ - name: Use Node.js
+ uses: actions/setup-node@v4.4.0
+ with:
+ node-version-file: '.node-version'
+ cache: 'pnpm'
+ - run: pnpm i --frozen-lockfile
+ - name: Check pnpm-lock.yaml
+ run: git diff --exit-code pnpm-lock.yaml
+ - name: Copy Configure
+ run: cp .github/misskey/test.yml .config/default.yml
+ - name: Build
+ run: pnpm build
+ - name: Run migrations
+ run: pnpm --filter backend migrate
+ - name: Measure memory usage
+ run: |
+ # Start the server and measure memory usage
+ node packages/backend/scripts/measure-memory.mjs > ${{ matrix.memory-json-name }}
+ - name: Upload Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: memory-artifact-${{ matrix.memory-json-name }}
+ path: ${{ matrix.memory-json-name }}
+
+ save-pr-number:
+ runs-on: ubuntu-latest
+ permissions: {}
+ steps:
+ - name: Save PR number
+ env:
+ PR_NUMBER: ${{ github.event.number }}
+ run: |
+ echo "$PR_NUMBER" > ./pr_number
+ - uses: actions/upload-artifact@v4
+ with:
+ name: memory-artifact-pr-number
+ path: pr_number