Files
Curse/.github/workflows/get-backend-memory.yml
Copilot 0b77dc8c48 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 6f76a121ef.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2025-12-03 16:02:49 +09:00

86 lines
2.2 KiB
YAML

# 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