mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 15:35:14 +02:00
211 lines
7.6 KiB
YAML
211 lines
7.6 KiB
YAML
name: Frontend browser diagnostics (inspect)
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
- ready_for_review
|
|
paths:
|
|
- packages/frontend/**
|
|
- packages/frontend-shared/**
|
|
- packages/frontend-builder/**
|
|
- packages/backend/**
|
|
- packages/i18n/**
|
|
- packages/icons-subsetter/**
|
|
- packages/misskey-js/**
|
|
- packages/misskey-reversi/**
|
|
- packages/misskey-bubble-game/**
|
|
- package.json
|
|
- pnpm-lock.yaml
|
|
- pnpm-workspace.yaml
|
|
- .node-version
|
|
- .github/misskey/test.yml
|
|
- .github/scripts/utility.mts
|
|
- .github/scripts/heap-snapshot-util.mts
|
|
- .github/scripts/chrome.mts
|
|
- .github/scripts/frontend-browser-diagnostics.render-additional-html.mts
|
|
- .github/scripts/frontend-browser-diagnostics.render-md.mts
|
|
- .github/scripts/frontend-browser-diagnostics.inspect.mts
|
|
- .github/workflows/frontend-browser-diagnostics.inspect.yml
|
|
- .github/workflows/frontend-browser-diagnostics.comment.yml
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: frontend-browser-diagnostics-inspect-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
report:
|
|
name: Measure frontend browser metrics
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
|
|
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.3
|
|
with:
|
|
persist-credentials: false
|
|
repository: ${{ github.event.pull_request.base.repo.full_name }}
|
|
ref: ${{ github.event.pull_request.base.sha }}
|
|
path: before
|
|
submodules: true
|
|
|
|
- name: Checkout pull request
|
|
uses: actions/checkout@v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
path: after
|
|
submodules: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6.0.9
|
|
with:
|
|
package_json_file: after/package.json
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6.4.0
|
|
with:
|
|
node-version-file: after/.node-version
|
|
cache: pnpm
|
|
cache-dependency-path: |
|
|
before/pnpm-lock.yaml
|
|
after/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies for base
|
|
working-directory: before
|
|
run: pnpm i --frozen-lockfile
|
|
|
|
- name: Configure base
|
|
working-directory: before
|
|
run: cp .github/misskey/test.yml .config
|
|
|
|
- name: Build base
|
|
working-directory: before
|
|
run: pnpm build
|
|
|
|
- name: Install dependencies for pull request
|
|
working-directory: after
|
|
run: pnpm i --frozen-lockfile
|
|
|
|
- name: Configure pull request
|
|
working-directory: after
|
|
run: cp .github/misskey/test.yml .config
|
|
|
|
- name: Build pull request
|
|
working-directory: after
|
|
run: pnpm build
|
|
|
|
- name: Install Playwright browsers
|
|
working-directory: after/packages/frontend
|
|
run: pnpm exec playwright install --with-deps --no-shell chromium
|
|
|
|
- name: Measure frontend browser metrics
|
|
shell: bash
|
|
env:
|
|
FRONTEND_BROWSER_METRICS_SAMPLE_COUNT: 5
|
|
MK_ENABLE_CROSS_ORIGIN_ISOLATION: "true"
|
|
run: |
|
|
REPORT_DIR="$RUNNER_TEMP/frontend-browser-diagnostics"
|
|
mkdir -p "$REPORT_DIR"
|
|
node after/.github/scripts/frontend-browser-diagnostics.inspect.mts before after "$REPORT_DIR/before-browser.json" "$REPORT_DIR/after-browser.json"
|
|
|
|
- name: Upload browser base heap snapshot
|
|
id: upload-browser-base-heap-snapshot
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: base-heap-snapshot.heapsnapshot
|
|
archive: false
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
- name: Upload browser head heap snapshot
|
|
id: upload-browser-head-heap-snapshot
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: head-heap-snapshot.heapsnapshot
|
|
archive: false
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
- name: Generate browser detailed html
|
|
shell: bash
|
|
run: |
|
|
REPORT_DIR="$RUNNER_TEMP/frontend-browser-diagnostics"
|
|
test -s "$REPORT_DIR/before-browser.json"
|
|
test -s "$REPORT_DIR/after-browser.json"
|
|
node after/.github/scripts/frontend-browser-diagnostics.render-additional-html.mts "$REPORT_DIR/before-browser.json" "$REPORT_DIR/after-browser.json" "$REPORT_DIR/frontend-browser-detailed-html.html"
|
|
|
|
- name: Upload browser detailed html
|
|
id: upload-browser-detailed-html
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: frontend-browser-metrics-detailed-html
|
|
path: ${{ runner.temp }}/frontend-browser-diagnostics/frontend-browser-detailed-html.html
|
|
if-no-files-found: error
|
|
archive: false
|
|
retention-days: 7
|
|
|
|
- name: Generate browser metrics report
|
|
shell: bash
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
FRONTEND_BROWSER_BASE_HEAP_SNAPSHOT_ARTIFACT_URL: ${{ steps.upload-browser-base-heap-snapshot.outputs.artifact-url }}
|
|
FRONTEND_BROWSER_HEAD_HEAP_SNAPSHOT_ARTIFACT_URL: ${{ steps.upload-browser-head-heap-snapshot.outputs.artifact-url }}
|
|
FRONTEND_BROWSER_DETAILED_HTML_ARTIFACT_URL: ${{ steps.upload-browser-detailed-html.outputs.artifact-url }}
|
|
run: |
|
|
REPORT_DIR="$RUNNER_TEMP/frontend-browser-diagnostics"
|
|
test -s "$REPORT_DIR/before-browser.json"
|
|
test -s "$REPORT_DIR/after-browser.json"
|
|
node after/.github/scripts/frontend-browser-diagnostics.render-md.mts "$REPORT_DIR/before-browser.json" "$REPORT_DIR/after-browser.json" "$REPORT_DIR/frontend-browser-diagnostics.md"
|
|
printf '%s\n' "$PR_NUMBER" > "$REPORT_DIR/pr-number.txt"
|
|
printf '%s\n' "$BASE_SHA" > "$REPORT_DIR/base-sha.txt"
|
|
printf '%s\n' "$HEAD_SHA" > "$REPORT_DIR/head-sha.txt"
|
|
printf '%s\n' "${{ github.event.pull_request.html_url }}" > "$REPORT_DIR/pr-url.txt"
|
|
|
|
- name: Check browser metrics report
|
|
shell: bash
|
|
run: |
|
|
REPORT_DIR="$RUNNER_TEMP/frontend-browser-diagnostics"
|
|
test -s "$REPORT_DIR/frontend-browser-diagnostics.md"
|
|
test -s "$REPORT_DIR/frontend-browser-detailed-html.html"
|
|
test -s "$REPORT_DIR/pr-number.txt"
|
|
test -s "$REPORT_DIR/head-sha.txt"
|
|
cat "$REPORT_DIR/frontend-browser-diagnostics.md" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Upload browser metrics report
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: frontend-browser-diagnostics
|
|
path: |
|
|
${{ runner.temp }}/frontend-browser-diagnostics/before-browser.json
|
|
${{ runner.temp }}/frontend-browser-diagnostics/after-browser.json
|
|
${{ runner.temp }}/frontend-browser-diagnostics/frontend-browser-diagnostics.md
|
|
${{ runner.temp }}/frontend-browser-diagnostics/pr-number.txt
|
|
${{ runner.temp }}/frontend-browser-diagnostics/base-sha.txt
|
|
${{ runner.temp }}/frontend-browser-diagnostics/head-sha.txt
|
|
${{ runner.temp }}/frontend-browser-diagnostics/pr-url.txt
|
|
if-no-files-found: error
|
|
retention-days: 7
|