From e5be8023252c0e553652f68a3d7e7781c3657f72 Mon Sep 17 00:00:00 2001 From: Anton Lantukh Date: Wed, 12 Jul 2023 10:07:58 +0200 Subject: [PATCH] feat(project): lighthouse check --- .github/workflows/firebase-live.yml | 4 ++-- .github/workflows/firebase-preview.yml | 8 +++++--- .github/workflows/lhci.yml | 24 +++++++++++------------- lighthouserc.js | 20 +++++++++++++------- public/locales/en/demo.json | 2 +- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/firebase-live.yml b/.github/workflows/firebase-live.yml index 9464ba0b7..910122865 100644 --- a/.github/workflows/firebase-live.yml +++ b/.github/workflows/firebase-live.yml @@ -16,6 +16,6 @@ jobs: run: yarn && MODE=demo yarn build - uses: FirebaseExtended/action-hosting-deploy@v0 with: - repoToken: "${{ secrets.GITHUB_TOKEN }}" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' channelId: live diff --git a/.github/workflows/firebase-preview.yml b/.github/workflows/firebase-preview.yml index d88b71cbf..47a1a4420 100644 --- a/.github/workflows/firebase-preview.yml +++ b/.github/workflows/firebase-preview.yml @@ -2,7 +2,7 @@ name: 'Firebase Preview' on: pull_request: - branches: [ 'develop', 'feat/*', 'feature/*' ] + branches: ['develop', 'feat/*', 'feature/*'] jobs: build_and_preview: @@ -15,6 +15,8 @@ jobs: run: yarn && MODE=preview yarn build - uses: FirebaseExtended/action-hosting-deploy@v0 with: - repoToken: "${{ secrets.GITHUB_TOKEN }}" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' expires: 30d + - name: Export url + run: echo urls ${{steps.firebase_hosting_preview.outputs.url}} diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml index 153fe1caf..a9c28fae5 100644 --- a/.github/workflows/lhci.yml +++ b/.github/workflows/lhci.yml @@ -1,22 +1,20 @@ name: Lighthouse -on: [workflow_dispatch] + +on: + workflow_run: + workflows: ['Firebase Preview'] + types: + - completed + jobs: lhci: name: Lighthouse runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 18.x - uses: actions/setup-node@v1 - with: - node-version: 18.x - - name: yarn install, build - run: | - yarn install - yarn run build - name: install Lighthouse CI run: | - sudo yarn global add @lhci/cli@0.7.x http-server + sudo yarn global add @lhci/cli@0.12.x http-server - name: run Lighthouse CI - run: | - lhci autorun + with: + LHCI_SERVER_BASE_URL: '${{ github.event.client_payload.url }}' + run: lhci autorun diff --git a/lighthouserc.js b/lighthouserc.js index a2a00469e..1ba4d6373 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -1,16 +1,22 @@ module.exports = { ci: { - collect: { - url: ['http://127.0.0.1:4000'], - startServerCommand: 'http-server ./build -p 4000 -g', - startServerReadyPattern: 'Available on', - numberOfRuns: 1, - }, + // collect: { + // url: ['http://127.0.0.1:4000'], + // startServerCommand: 'http-server ./build/public -p 4000 -g', + // startServerReadyPattern: 'Available on', + // numberOfRuns: 1, + // }, upload: { target: 'temporary-public-storage', }, assert: { - preset: 'lighthouse:no-pwa', + assertions: { + 'categories:performance': ['warn', { minScore: 0.9 }], + 'categories:seo': ['error', { minScore: 0.9 }], + 'categories:accessibility': ['warn', { minScore: 0.9 }], + 'categories:best-practices': ['warn', { minScore: 0.9 }], + 'categories:pwa': ['warn', { minScore: 0.9 }], + }, }, }, }; diff --git a/public/locales/en/demo.json b/public/locales/en/demo.json index 2e53ab3cc..77338558e 100644 --- a/public/locales/en/demo.json +++ b/public/locales/en/demo.json @@ -1,6 +1,6 @@ { "app_config_not_found": "Invalid or Missing App Config", - "app_config_learn_more": "Learn more about the App Config creation", + "app_config_learn_more": "Learn more about App Configs", "cancel_config_id": "Cancel", "click_to_unselect_config": "(click here to unselect this config)", "currently_previewing_config": "You are currently previewing config: '{{configSource}}'",