From 988040832e78f2841c81a988bb3ffc85744d01f5 Mon Sep 17 00:00:00 2001 From: octo-guic Date: Mon, 12 Feb 2024 15:57:47 +0100 Subject: [PATCH] tech: ajout lighthouse ci --- .github/workflows/lighthouse.yml | 22 ++++++++++++++++++++++ .github/workflows/main.yml | 1 + .lighthouserc.cjs | 25 +++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 .github/workflows/lighthouse.yml create mode 100644 .lighthouserc.cjs diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml new file mode 100644 index 000000000..d5f16b5be --- /dev/null +++ b/.github/workflows/lighthouse.yml @@ -0,0 +1,22 @@ +name: Lighthouse CI + +on: [push] + +jobs: + lhci: + name: Lighthouse + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: yarn install, build + run: | + yarn install + yarn run build + - name: run Lighthouse CI + run: | + yarn global add @lhci/cli@0.13.x + lhci autorun diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce4996ca2..29754e2cb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - main + workflow_dispatch: jobs: build-and-test: diff --git a/.lighthouserc.cjs b/.lighthouserc.cjs new file mode 100644 index 000000000..d07198dfd --- /dev/null +++ b/.lighthouserc.cjs @@ -0,0 +1,25 @@ +module.exports = { + ci: { + collect: { + // Spécifiez les options de collecte ici + // Par exemple, vous pouvez définir le nombre de runs et les URL à tester + numberOfRuns: 3, + url: [ + 'https://agir.beta.gouv.fr/', + 'https://agir.beta.gouv.fr/onboarding', + 'https://agir.beta.gouv.fr/authentification', + 'https://agir.beta.gouv.fr/creation-compte', + 'https://agir.beta.gouv.fr/vos-aides/', + ], // Remplacez par l'URL de votre app en développement ou en production + }, + assert: { + assertions: { + 'categories:performance': ['error', { minScore: 0.1 }], + 'categories:accessibility': ['error', { minScore: 0.1 }], + }, + }, + upload: { + target: 'temporary-public-storage', // Pour tester, utilisez 'temporary-public-storage' + }, + }, +};