mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 21:24:50 +02:00
94 lines
3.1 KiB
YAML
94 lines
3.1 KiB
YAML
name: Frontend bundle visualizer
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
- ready_for_review
|
|
paths:
|
|
- packages/frontend/**
|
|
- packages/frontend-shared/**
|
|
- packages/frontend-builder/**
|
|
- 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/scripts/frontend-bundle-visualizer-report.mjs
|
|
- .github/workflows/frontend-bundle-visualizer.yml
|
|
- .github/workflows/frontend-bundle-visualizer-comment.yml
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: frontend-bundle-visualizer-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
visualize:
|
|
name: Build frontend bundle visualizer
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout pull request
|
|
uses: actions/checkout@v6.0.2
|
|
with:
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
submodules: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6.0.3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6.4.0
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i --frozen-lockfile
|
|
|
|
- name: Build frontend dependencies
|
|
run: pnpm --filter "frontend^..." run build
|
|
|
|
- name: Prepare visualizer output
|
|
run: mkdir -p "$RUNNER_TEMP/frontend-bundle-visualizer"
|
|
|
|
- name: Build frontend visualizer
|
|
env:
|
|
FRONTEND_BUNDLE_VISUALIZER: 'true'
|
|
FRONTEND_BUNDLE_VISUALIZER_TEMPLATE: raw-data
|
|
FRONTEND_BUNDLE_VISUALIZER_FILE: ${{ runner.temp }}/frontend-bundle-visualizer/stats.json
|
|
run: pnpm --filter frontend run build
|
|
|
|
- name: Generate visualizer report
|
|
run: node .github/scripts/frontend-bundle-visualizer-report.mjs "$RUNNER_TEMP/frontend-bundle-visualizer/stats.json" "$RUNNER_TEMP/frontend-bundle-visualizer/report.md"
|
|
|
|
- name: Check visualizer report
|
|
run: |
|
|
test -s "$RUNNER_TEMP/frontend-bundle-visualizer/stats.json"
|
|
test -s "$RUNNER_TEMP/frontend-bundle-visualizer/report.md"
|
|
cat "$RUNNER_TEMP/frontend-bundle-visualizer/report.md" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Write report metadata
|
|
run: |
|
|
printf '%s\n' "${{ github.event.pull_request.number }}" > "$RUNNER_TEMP/frontend-bundle-visualizer/pr-number.txt"
|
|
printf '%s\n' "${{ github.event.pull_request.head.sha }}" > "$RUNNER_TEMP/frontend-bundle-visualizer/head-sha.txt"
|
|
printf '%s\n' "${{ github.event.pull_request.html_url }}" > "$RUNNER_TEMP/frontend-bundle-visualizer/pr-url.txt"
|
|
|
|
- name: Upload visualizer report
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: frontend-bundle-visualizer-report
|
|
path: ${{ runner.temp }}/frontend-bundle-visualizer/
|
|
if-no-files-found: error
|
|
retention-days: 7
|