From cab1043a46bdebf82975973e952f351f8a9dd92c Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Thu, 30 Oct 2025 16:21:41 +0100 Subject: [PATCH] build: restore old lighthouse-ci.yml cfg --- .github/workflows/lighthouse-ci.yml | 88 +++++++++++++++-------------- tools/lighthouse/.lighthouserc.json | 51 +---------------- tools/lighthouse/budget.json | 49 ++++++++++++++++ 3 files changed, 95 insertions(+), 93 deletions(-) create mode 100644 tools/lighthouse/budget.json diff --git a/.github/workflows/lighthouse-ci.yml b/.github/workflows/lighthouse-ci.yml index 79583d0a7..bd287bbf0 100644 --- a/.github/workflows/lighthouse-ci.yml +++ b/.github/workflows/lighthouse-ci.yml @@ -1,43 +1,45 @@ -#name: Lighthouse CI -#on: -# pull_request: -# branches: -# - master -# - main -# workflow_dispatch: -# inputs: {} -# release: -# types: [published] -# -#jobs: -# lighthouse: -# runs-on: ubuntu-latest -# env: -# UNSPLASH_KEY: ${{ secrets.UNSPLASH_KEY }} -# UNSPLASH_CLIENT_ID: ${{ secrets.UNSPLASH_CLIENT_ID }} -# steps: -# - uses: actions/checkout@v5 -# -# - uses: actions/setup-node@v5 -# with: -# node-version: 20 -# cache: 'npm' -# -# - name: Install dependencies -# run: npm i -# -# - run: npm run env # Generate env.generated.ts -# -# - name: Build production web app -# run: npm run buildFrontend:prodWeb -# -# - name: Run Lighthouse CI -# uses: treosh/lighthouse-ci-action@v12 -# with: -# # Configure Lighthouse CI -# configPath: './tools/lighthouse/.lighthouserc.json' -# # Upload results to temporary storage -# uploadArtifacts: true -# temporaryPublicStorage: true -# # Run 3 times for consistency -# runs: 3 +name: Lighthouse CI +on: + pull_request: + branches: + - master + - main + workflow_dispatch: + inputs: {} + release: + types: [published] + +jobs: + lighthouse: + runs-on: ubuntu-latest + env: + UNSPLASH_KEY: ${{ secrets.UNSPLASH_KEY }} + UNSPLASH_CLIENT_ID: ${{ secrets.UNSPLASH_CLIENT_ID }} + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-node@v5 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm i + + - run: npm run env # Generate env.generated.ts + + - name: Build production web app + run: npm run buildFrontend:prodWeb + + - name: Run Lighthouse CI + uses: treosh/lighthouse-ci-action@v12 + with: + # Configure Lighthouse CI + configPath: './tools/lighthouse/.lighthouserc.json' + # Upload results to temporary storage + uploadArtifacts: true + temporaryPublicStorage: true + # Run 3 times for consistency + runs: 3 + # Configure budgets + budgetPath: './tools/lighthouse/budget.json' diff --git a/tools/lighthouse/.lighthouserc.json b/tools/lighthouse/.lighthouserc.json index 36ff17491..a9c5d1637 100644 --- a/tools/lighthouse/.lighthouserc.json +++ b/tools/lighthouse/.lighthouserc.json @@ -3,56 +3,7 @@ "collect": { "staticDistDir": "./dist", "numberOfRuns": 3, - "url": ["/browser/index.html"], - "budgets": [ - { - "path": "/*", - "resourceSizes": [ - { - "resourceType": "script", - "budget": 1200 - }, - { - "resourceType": "stylesheet", - "budget": 100 - }, - { - "resourceType": "image", - "budget": 300 - }, - { - "resourceType": "font", - "budget": 100 - }, - { - "resourceType": "total", - "budget": 1500 - } - ], - "resourceCounts": [ - { - "resourceType": "script", - "budget": 100 - }, - { - "resourceType": "stylesheet", - "budget": 10 - }, - { - "resourceType": "image", - "budget": 50 - }, - { - "resourceType": "font", - "budget": 10 - }, - { - "resourceType": "total", - "budget": 150 - } - ] - } - ] + "url": ["http://localhost/browser/index.html"] }, "assert": { "preset": "lighthouse:no-pwa", diff --git a/tools/lighthouse/budget.json b/tools/lighthouse/budget.json new file mode 100644 index 000000000..4c0ec0b54 --- /dev/null +++ b/tools/lighthouse/budget.json @@ -0,0 +1,49 @@ +[ + { + "path": "/*", + "resourceSizes": [ + { + "resourceType": "script", + "budget": 1200 + }, + { + "resourceType": "stylesheet", + "budget": 100 + }, + { + "resourceType": "image", + "budget": 300 + }, + { + "resourceType": "font", + "budget": 100 + }, + { + "resourceType": "total", + "budget": 1500 + } + ], + "resourceCounts": [ + { + "resourceType": "script", + "budget": 120 + }, + { + "resourceType": "stylesheet", + "budget": 10 + }, + { + "resourceType": "image", + "budget": 50 + }, + { + "resourceType": "font", + "budget": 10 + }, + { + "resourceType": "total", + "budget": 150 + } + ] + } +]