From 0d004eb216c4dec331be93e0c35d3e369861b11a Mon Sep 17 00:00:00 2001 From: Anton Lantukh Date: Wed, 12 Jul 2023 11:50:34 +0200 Subject: [PATCH] feat(project): lighthouse actions triggering --- .github/workflows/firebase-preview.yml | 10 +++++++--- .github/workflows/lhci.yml | 20 +++++++++----------- .gitignore | 1 + lighthouserc.js | 9 +++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/firebase-preview.yml b/.github/workflows/firebase-preview.yml index ba203b262..25f6b4dea 100644 --- a/.github/workflows/firebase-preview.yml +++ b/.github/workflows/firebase-preview.yml @@ -1,4 +1,4 @@ -name: 'Firebase Preview' +name: Firebase Preview on: pull_request: @@ -14,9 +14,13 @@ jobs: APP_PLAYER_LICENSE_KEY: ${{ secrets.PLAYER_LICENSE_KEY }} run: yarn && MODE=preview yarn build - uses: FirebaseExtended/action-hosting-deploy@v0 + id: firebase_hosting_preview with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' expires: 30d - - name: Export url - run: echo urls ${{steps.firebase_hosting_preview.outputs.url}} + - name: Dispatch init event to run Lighthouse + env: + GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + run: | + gh workflow run 'Lighthouse' --ref '${{ github.event.pull_request.head.ref }}' -f url='${{ steps.firebase_hosting_preview.outputs.details_url }}' diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml index a9c28fae5..34fefbda7 100644 --- a/.github/workflows/lhci.yml +++ b/.github/workflows/lhci.yml @@ -1,20 +1,18 @@ name: Lighthouse on: - workflow_run: - workflows: ['Firebase Preview'] - types: - - completed + workflow_dispatch: + inputs: + url: + description: 'Fill preview link' jobs: lhci: name: Lighthouse runs-on: ubuntu-latest steps: - - name: install Lighthouse CI - run: | - sudo yarn global add @lhci/cli@0.12.x http-server - - name: run Lighthouse CI - with: - LHCI_SERVER_BASE_URL: '${{ github.event.client_payload.url }}' - run: lhci autorun + - uses: actions/checkout@v1 + - name: Install Lighthouse CI + run: sudo yarn global add @lhci/cli@0.12.x http-server + - name: Run Lighthouse CI + run: lhci autorun --collect.url=${{ github.event.inputs.url }}?app-config=gnnuzabk --config=./lighthouserc.js diff --git a/.gitignore b/.gitignore index 5f4fbbc82..1e466dee5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ yarn-error.log .firebase firebase-debug.log .stylelintcache +.lighthouseci # os or editor .idea diff --git a/lighthouserc.js b/lighthouserc.js index 1ba4d6373..c53baf810 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -1,11 +1,8 @@ module.exports = { ci: { - // collect: { - // url: ['http://127.0.0.1:4000'], - // startServerCommand: 'http-server ./build/public -p 4000 -g', - // startServerReadyPattern: 'Available on', - // numberOfRuns: 1, - // }, + collect: { + numberOfRuns: 3, + }, upload: { target: 'temporary-public-storage', },