From 73eb735d3b244f166c9d1e61cd778a2d4a899db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Fri, 22 Sep 2023 14:42:09 +0200 Subject: [PATCH 1/2] add foo-software/lighthouse-check-action workflow --- .github/workflows/generate-site-preview.yml | 2 +- .github/workflows/lighthouse-check.yml | 32 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lighthouse-check.yml diff --git a/.github/workflows/generate-site-preview.yml b/.github/workflows/generate-site-preview.yml index 5feb40496..f4d4dcd17 100644 --- a/.github/workflows/generate-site-preview.yml +++ b/.github/workflows/generate-site-preview.yml @@ -7,7 +7,7 @@ on: branches: - main paths: - - '.github/workflows/generate-site-preview.yml' + - '.github/workflows/*' - 'src/**/*' - 'static/**/*' - 'package.json' diff --git a/.github/workflows/lighthouse-check.yml b/.github/workflows/lighthouse-check.yml new file mode 100644 index 000000000..3a73a9432 --- /dev/null +++ b/.github/workflows/lighthouse-check.yml @@ -0,0 +1,32 @@ +name: ♿️ A11Y CI with Lighthouse Check +on: + pull_request: + paths: + - '**/.github/workflows/lighthouse-check.yml' + - '.github/workflows/generate-site-preview.yml' + - 'src/**/*' + - 'package.json' + - 'package-lock.json' + - 'gatsby-*.js' + - '.nvmrc' + +env: + WEBSITE_TO_AUDIT: 'https://process-analytics-process-analytics-dev-site_preview-pr-${{ github.event.pull_request.number }}.surge.sh/' + +jobs: + Lighthouse-Check-CLI: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + # Using the Lighthouse Check GitHub Action + # @see https://github.com/marketplace/actions/lighthouse-check + - name: Run Lighthouse Check GitHub Action + uses: foo-software/lighthouse-check-action@master + id: lighthouse_audit + with: + urls: ${{ env.WEBSITE_TO_AUDIT }} + gitHubAccessToken: ${{ secrets.GH_RELEASE_TOKEN }} + prCommentEnabled: true + prCommentSaveOld: false + device: all \ No newline at end of file From 1871d7f170249ed766d4418257bf2258890e3b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Fri, 22 Sep 2023 16:38:46 +0200 Subject: [PATCH 2/2] store result in artifact and check the minimum score to have --- .github/workflows/lighthouse-check.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lighthouse-check.yml b/.github/workflows/lighthouse-check.yml index 3a73a9432..eedac5265 100644 --- a/.github/workflows/lighthouse-check.yml +++ b/.github/workflows/lighthouse-check.yml @@ -23,10 +23,25 @@ jobs: # @see https://github.com/marketplace/actions/lighthouse-check - name: Run Lighthouse Check GitHub Action uses: foo-software/lighthouse-check-action@master - id: lighthouse_audit + id: lighthouseCheck with: + outputDirectory: ${{ github.workspace }}/tmp/artifacts urls: ${{ env.WEBSITE_TO_AUDIT }} gitHubAccessToken: ${{ secrets.GH_RELEASE_TOKEN }} prCommentEnabled: true prCommentSaveOld: false - device: all \ No newline at end of file + device: all + - name: Upload artifacts + uses: actions/upload-artifact@master + with: + name: Lighthouse reports + path: ${{ github.workspace }}/tmp/artifacts + - name: Verify Lighthouse Check results + uses: foo-software/lighthouse-check-status-action@master + with: + lighthouseCheckResults: ${{ steps.lighthouseCheck.outputs.lighthouseCheckResults }} + minAccessibilityScore: "90" + minBestPracticesScore: "50" + minPerformanceScore: "50" + minProgressiveWebAppScore: "50" + minSeoScore: "50" \ No newline at end of file