103 lines
3.3 KiB
YAML
103 lines
3.3 KiB
YAML
name: Bundle Budget Baseline
|
|
|
|
# Captures the main-branch bundle report. The report is both attached to the
|
|
# run and cached under a main-only prefix consumed by the pull-request gate.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "apps/web/**"
|
|
- "packages/brand/**"
|
|
- "packages/config/**"
|
|
- "packages/entitlements/**"
|
|
- "packages/form-widget/**"
|
|
- "packages/foundation/**"
|
|
- "packages/i18n/**"
|
|
- "packages/plugin-runtime/**"
|
|
- "packages/ui*/**"
|
|
- "packages/url/**"
|
|
- "packages/view-models/**"
|
|
- "package.json"
|
|
- "pnpm-lock.yaml"
|
|
- "scripts/bundle-budgets.json"
|
|
- "scripts/verify-bundle-size.mjs"
|
|
- ".gitea/workflows/bundle-budget-baseline.yml"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
HIVEGRID_GITEA_HOST_IP: ${{ vars.HIVEGRID_GITEA_HOST_IP }}
|
|
|
|
jobs:
|
|
capture:
|
|
name: Capture bundle baseline
|
|
runs-on: toolctrl-ci
|
|
timeout-minutes: 30
|
|
env:
|
|
DATABASE_URL: postgresql://hivegrid:hivegrid@localhost:5432/hivegrid?schema=public
|
|
steps:
|
|
- name: Resolve internal Gitea host
|
|
run: |
|
|
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
|
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
|
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
|
exit 1
|
|
fi
|
|
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
|
fi
|
|
|
|
- name: Checkout main
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Persist Node.js toolchain
|
|
run: bash scripts/ci/persist-node-toolchain.sh
|
|
|
|
- name: Enable Corepack
|
|
run: corepack enable --install-directory /usr/local/bin
|
|
|
|
- name: Prepare pnpm 11.12.0
|
|
run: corepack prepare pnpm@11.12.0 --activate
|
|
|
|
- name: Configure pnpm store
|
|
run: pnpm config set store-dir .pnpm-store
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: .pnpm-store
|
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: Prepare baseline cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: baseline/main-bundle-report.json
|
|
key: bundle-baseline-main-${{ gitea.sha }}
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Build web
|
|
run: pnpm --filter @hivegrid/web build
|
|
|
|
- name: Verify aggregate bundle budgets
|
|
run: pnpm run verify:bundle-size
|
|
|
|
- name: Measure bundle sizes
|
|
run: |
|
|
mkdir -p baseline
|
|
node scripts/verify-bundle-size.mjs --json > baseline/main-bundle-report.json
|
|
|
|
- name: Upload baseline report
|
|
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
|
with:
|
|
name: bundle-baseline-main-${{ gitea.run_id }}
|
|
path: baseline/main-bundle-report.json
|
|
retention-days: 30
|