Experimental touch #59
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: perf | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'web/**' | |
| - '.github/workflows/perf.yml' | |
| workflow_dispatch: | |
| inputs: | |
| runner: | |
| description: 'Runner to use (manual runs only)' | |
| type: choice | |
| options: | |
| - arc-runner | |
| - ubuntu-latest | |
| default: arc-runner | |
| concurrency: | |
| group: perf-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| lighthouse: | |
| name: Lighthouse CI | |
| # Pin to ubuntu-latest because lighthouse-ci-action requires Chrome, | |
| # which the self-hosted arc-runner image does not ship (`CHROME_PATH | |
| # environment variable must be set to a Chrome/Chromium executable`). | |
| # GitHub-hosted ubuntu-latest has Chrome preinstalled. | |
| runs-on: ${{ inputs.runner || 'ubuntu-latest' }} | |
| defaults: | |
| run: | |
| working-directory: web | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install | |
| run: npm ci --legacy-peer-deps | |
| - name: Build | |
| run: npm run build | |
| - name: Bundle-size budget (strict) | |
| run: npm run perf:check | |
| - name: Start preview server | |
| run: | | |
| npx vite preview --port 4173 --strictPort > preview.log 2>&1 & | |
| echo $! > preview.pid | |
| # Wait for server to be reachable | |
| for i in $(seq 1 30); do | |
| if curl -fsS http://localhost:4173/ -o /dev/null; then | |
| echo "preview server is up" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "preview server failed to start" | |
| cat preview.log | |
| exit 1 | |
| - name: Lighthouse CI | |
| uses: treosh/lighthouse-ci-action@v12 | |
| with: | |
| urls: | | |
| http://localhost:4173/ | |
| http://localhost:4173/vehicles | |
| http://localhost:4173/drives | |
| http://localhost:4173/analytics | |
| http://localhost:4173/charging | |
| uploadArtifacts: true | |
| temporaryPublicStorage: true | |
| configPath: ./web/lighthouserc.json | |
| runs: 1 | |
| - name: Stop preview server | |
| if: always() | |
| run: | | |
| if [ -f preview.pid ]; then | |
| kill "$(cat preview.pid)" 2>/dev/null || true | |
| fi |