From d43d78b91088fdd694766b2a3b70827fe1806391 Mon Sep 17 00:00:00 2001 From: Rossella Ferrandino <39148794+RossellaFer@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:04:02 +0200 Subject: [PATCH] #5 lighthouse audit checks --- .eslintrc.cjs | 2 +- .github/workflows/lighthouse-ci.yml | 23 ++++++++++------------- lighthouserc.cjs | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 lighthouserc.cjs diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 15864fd..5441443 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -8,7 +8,7 @@ module.exports = { 'plugin:react/recommended', 'plugin:react/jsx-runtime' ], - ignorePatterns: ['dist', '.eslintrc.cjs', '*.html'], + ignorePatterns: ['dist', '.eslintrc.cjs', 'lighthouserc.cjs', '*.html'], parser: '@typescript-eslint/parser', parserOptions: { project: ["tsconfig.json", "tsconfig.node.json"] diff --git a/.github/workflows/lighthouse-ci.yml b/.github/workflows/lighthouse-ci.yml index 2914121..f0cd4d9 100644 --- a/.github/workflows/lighthouse-ci.yml +++ b/.github/workflows/lighthouse-ci.yml @@ -1,16 +1,13 @@ -name: Audit live site -on: push - +name: CI +on: [push] jobs: - audit: + lighthouseci: runs-on: ubuntu-latest steps: - - name: Audit live URL - uses: jakejarvis/lighthouse-action@master - with: - url: 'https://womeninsoftware.jp/' - - name: Upload results as an artifact - uses: actions/upload-artifact@master - with: - name: report - path: './report' \ No newline at end of file + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: npm install && npm install -g @lhci/cli@0.13.x + - run: npm run build + - run: lhci autorun \ No newline at end of file diff --git a/lighthouserc.cjs b/lighthouserc.cjs new file mode 100644 index 0000000..7a7c541 --- /dev/null +++ b/lighthouserc.cjs @@ -0,0 +1,21 @@ +module.exports = { + ci: { + upload: { + target: 'temporary-public-storage', + }, + collect: { + staticDistDir: './dist', + "url": [ + "http://localhost/" + ] + }, + asserts: { + assertions: { + 'categories:accessibility': ['warn', { minScore: 1 }], + 'categories:best-practices': ['warn', { minScore: 1.0 }], + 'categories:performance': ['warn', { minScore: 0.2 }], + 'categories:seo': ['warn', { minScore: 1.0 }], + }, + }, + }, + }; \ No newline at end of file