diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml new file mode 100644 index 0000000..6e8d12a --- /dev/null +++ b/.github/workflows/lighthouse.yml @@ -0,0 +1,15 @@ +name: Lighthouse CI +on: [push, pull_request] +jobs: + lighthouse: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + - run: npm install + - run: npm run build + - name: run Lighthouse CI + run: npx @lhci/cli autorun diff --git a/.lighthouserc.js b/.lighthouserc.js new file mode 100644 index 0000000..730da79 --- /dev/null +++ b/.lighthouserc.js @@ -0,0 +1,24 @@ +module.exports = { + ci: { + collect: { + startServerCommand: 'npm run start', + url: ['http://localhost:3000'], + numberOfRuns: 3, + settings: { + chromeFlags: '--no-sandbox --disable-setuid-sandbox --headless', + }, + }, + assert: { + assertions: { + 'categories:performance': ['warn', {minScore: 0.9}], + 'categories:accessibility': ['error', {minScore: 0.95}], + 'first-contentful-paint': ['warn', {maxNumericValue: 2000}], + 'interactive': ['error', {maxNumericValue: 3500}], + 'mainthread-work-breakdown:total': ['warn', {maxNumericValue: 5000}], + }, + }, + upload: { + target: 'temporary-public-storage', + }, + }, +};