mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-25 17:10:43 +00:00
125 lines
3.6 KiB
YAML
125 lines
3.6 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/scripts/utility.mts
|
|
- .github/scripts/backend-memory-report.mts
|
|
- .github/scripts/measure-backend-memory-comparison.mts
|
|
- .github/scripts/backend-js-footprint.mjs
|
|
- .github/scripts/backend-js-footprint-loader.mjs
|
|
- .github/scripts/backend-js-footprint-require.cjs
|
|
- .github/workflows/get-backend-memory.yml
|
|
- .github/workflows/report-backend-memory.yml
|
|
|
|
jobs:
|
|
get-memory-usage:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18
|
|
ports:
|
|
- 54312:5432
|
|
env:
|
|
POSTGRES_DB: test-misskey
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
redis:
|
|
image: redis:8
|
|
ports:
|
|
- 56312:6379
|
|
|
|
steps:
|
|
- name: Checkout base
|
|
uses: actions/checkout@v6.0.2
|
|
with:
|
|
ref: ${{ github.base_ref }}
|
|
path: base
|
|
submodules: true
|
|
- name: Checkout head
|
|
uses: actions/checkout@v6.0.2
|
|
with:
|
|
ref: refs/pull/${{ github.event.number }}/merge
|
|
path: head
|
|
submodules: true
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6.0.3
|
|
with:
|
|
package_json_file: head/package.json
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v6.4.0
|
|
with:
|
|
node-version-file: 'head/.node-version'
|
|
cache: 'pnpm'
|
|
cache-dependency-path: |
|
|
base/pnpm-lock.yaml
|
|
head/pnpm-lock.yaml
|
|
- name: Install base dependencies
|
|
working-directory: base
|
|
run: pnpm i --frozen-lockfile
|
|
- name: Check base pnpm-lock.yaml
|
|
working-directory: base
|
|
run: git diff --exit-code pnpm-lock.yaml
|
|
- name: Configure base
|
|
working-directory: base
|
|
run: |
|
|
cp .github/misskey/test.yml .config/default.yml
|
|
pnpm compile-config
|
|
- name: Build base
|
|
working-directory: base
|
|
run: pnpm build
|
|
- name: Install head dependencies
|
|
working-directory: head
|
|
run: pnpm i --frozen-lockfile
|
|
- name: Check head pnpm-lock.yaml
|
|
working-directory: head
|
|
run: git diff --exit-code pnpm-lock.yaml
|
|
- name: Configure head
|
|
working-directory: head
|
|
run: |
|
|
cp .github/misskey/test.yml .config/default.yml
|
|
pnpm compile-config
|
|
- name: Build head
|
|
working-directory: head
|
|
run: pnpm build
|
|
- name: Measure backend memory usage
|
|
env:
|
|
MK_MEMORY_COMPARE_ROUNDS: 5
|
|
MK_MEMORY_COMPARE_WARMUP_ROUNDS: 1
|
|
MK_MEMORY_HEAP_SNAPSHOT: 1
|
|
run: node head/.github/scripts/measure-backend-memory-comparison.mts base head memory-base.json memory-head.json
|
|
- name: Measure backend loaded JS footprint
|
|
run: |
|
|
node head/.github/scripts/backend-js-footprint.mjs base js-footprint-base.json
|
|
node head/.github/scripts/backend-js-footprint.mjs head js-footprint-head.json
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: memory-artifact-results
|
|
path: |
|
|
memory-base.json
|
|
memory-head.json
|
|
js-footprint-base.json
|
|
js-footprint-head.json
|
|
|
|
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@v7
|
|
with:
|
|
name: memory-artifact-pr-number
|
|
path: pr_number
|