-
-
Notifications
You must be signed in to change notification settings - Fork 274
configure lighthouse for local development/testing #2122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
a936333
508b0cd
9bd7d77
7537508
f747ec0
140280b
4c54029
c7a2825
05bb9ef
253447a
d7c80dc
c391377
f8b360f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -485,22 +485,32 @@ jobs: | |
|
|
||
| run-lighthouse-ci: | ||
| name: Run Lighthouse CI | ||
| needs: | ||
| - deploy-staging-nest-proxy | ||
| # needs: | ||
| # - deploy-staging-nest-proxy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda | ||
| with: | ||
| version: 10 | ||
| run_install: true | ||
|
|
||
| - name: Set up Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 | ||
| with: | ||
| node-version: 22 | ||
| cache: 'pnpm' | ||
| cache-dependency-path: frontend/pnpm-lock.yaml | ||
|
|
||
| - name: Run Lighthouse CI | ||
| - name: Run lighthouse-ci | ||
| working-directory: frontend | ||
| env: | ||
| LHCI_URL: 'https://nest.owasp.dev/' | ||
| run: | | ||
| npx -y @lhci/[email protected] autorun | ||
| pnpm run lighthouse-ci | ||
|
|
||
| build-production-images: | ||
| name: Build Production Images | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ jumpstart | |
| kasya | ||
| lhci | ||
| libexpat | ||
| lighthouseci | ||
| linkify | ||
| lte | ||
| lxml | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,10 @@ format-frontend-code: | |
| && pnpm run format)) | ||
|
|
||
| lighthouse-ci: | ||
| @cd frontend && npx -y @lhci/[email protected] autorun --collect.url=http://localhost:3000 | ||
| @cd frontend && pnpm run lighthouse-ci | ||
|
|
||
| lighthouse-ci-desktop: | ||
| @cd frontend && pnpm run lighthouse-ci:desktop | ||
|
|
||
| lint-frontend-code: | ||
| @(cd frontend && pnpm run lint:check >/dev/null 2>&1 \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| const LHCI_CHROME_FLAGS = | ||
| process.env.LHCI_CHROME_FLAGS || '--disable-dev-shm-usage --headless --no-sandbox' | ||
| const LHCI_URL = process.env.LHCI_URL || 'http://localhost:3000/' | ||
|
|
||
| module.exports = { | ||
| ci: { | ||
| assert: { | ||
| assertions: { | ||
| 'categories:accessibility': ['warn', { minScore: 0.9 }], | ||
| 'categories:best-practices': ['warn', { minScore: 0.9 }], | ||
| 'categories:performance': ['warn', { minScore: 0.9 }], | ||
| 'categories:seo': ['warn', { minScore: 0.9 }], | ||
| }, | ||
| }, | ||
| collect: { | ||
| numberOfRuns: 3, | ||
| settings: { | ||
| chromeFlags: LHCI_CHROME_FLAGS, | ||
| }, | ||
| url: [LHCI_URL], | ||
| }, | ||
| upload: { | ||
| target: 'temporary-public-storage', | ||
| }, | ||
| }, | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ | |
| "dev": "next dev --port 3000", | ||
| "format": "prettier --log-level warn --write .", | ||
| "format:check": "prettier --check .", | ||
| "lighthouse-ci": "lhci autorun", | ||
| "lighthouse-ci:desktop": "lhci autorun --collect.settings.preset=desktop", | ||
|
Comment on lines
+11
to
+12
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between those 2 targets? Do we need the desktop preset for local running?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default, lighthouse opens all pages as a mobile device, this is if we want to test the desktop version
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not required, testing as a mobile device is enough but I think accessibility and some UI may differ for both devices, it's a good to have |
||
| "lint": "eslint . --config eslint.config.mjs --fix --max-warnings=0", | ||
| "lint:check": "eslint . --config eslint.config.mjs --max-warnings=0", | ||
| "start": "next start", | ||
|
|
@@ -66,6 +68,7 @@ | |
| "@axe-core/react": "^4.10.2", | ||
| "@eslint/eslintrc": "^3.3.1", | ||
| "@eslint/js": "^9.33.0", | ||
| "@lhci/cli": "^0.15.1", | ||
| "@playwright/test": "^1.55.0", | ||
| "@swc/core": "^1.13.4", | ||
| "@swc/jest": "^0.2.39", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.