diff --git a/.github/workflows/lighthouse.yaml b/.github/workflows/lighthouse.yaml new file mode 100644 index 0000000..9588e46 --- /dev/null +++ b/.github/workflows/lighthouse.yaml @@ -0,0 +1,26 @@ +name: Lighthouse CI performance check +on: [push, pull_request] + +jobs: + performance_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node + uses: actions/setup-node@v1 + with: + node-version: 12.x + + - name: Install dependencies + run: npm install + + - name: Build website + run: npm run build --if-present + + - name: Run Lighthouse against public directory + uses: treosh/lighthouse-ci-action@v3 + with: + uploadArtifacts: true + temporaryPublicStorage: true + configPath: './lighthouserc.json' + runs: 3 diff --git a/lighthouserc.json b/lighthouserc.json new file mode 100644 index 0000000..f56b49c --- /dev/null +++ b/lighthouserc.json @@ -0,0 +1,19 @@ +{ + "ci": { + "collect": { + "url": ["http://localhost/", "http://localhost/404/", "http://localhost/page-2"], + "staticDistDir": "./public" + }, + "assert": { + "assertions": { + "categories:accessibility": ["error", { "minScore": 0.85 }], + "categories:best-practices": ["error", { "minScore": 0.8 }], + "categories:performance": ["error", { "minScore": 0.75 }], + "categories:seo": ["warn", { "minScore": 1 }], + "dom-size": ["warn", { "maxNumericValue": 1000 }], + "first-contentful-paint": ["error", { "maxNumericValue": 2500 }], + "interactive": ["error", { "maxNumericValue": 5000 }] + } + } + } +}