diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6ac95ee2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: [push, pull_request] + +jobs: + lighthouse: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[skip ci]')" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Install utilities + run: npm install -g netlify-cli @lhci/cli + - name: Wait for Netlify + run: netlify watch + env: + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + - name: Audit deploy preview + if: github.event_name == 'pull_request' + continue-on-error: true + run: | + lhci autorun --config=./lighthouserc.json \ + --collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/ \ + --collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/notes/ \ + --collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/notes/how-to-pull-request-fork-github/ \ + --collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/notes/how-to-pull-request-fork-github/amp.html + env: + LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} + - name: Audit jarv.is + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + continue-on-error: true + run: | + lhci autorun --config=./lighthouserc.json \ + --collect.url=https://jarv.is/ \ + --collect.url=https://jarv.is/notes/ \ + --collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/ \ + --collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/amp.html + env: + LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml deleted file mode 100644 index 720c3c74..00000000 --- a/.github/workflows/lighthouse.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Lighthouse - -on: [push, pull_request] - -jobs: - lhci: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 12.x - # https://github.com/actions/cache/blob/master/examples.md#node---yarn - # https://github.com/actions/cache/issues/60 - - name: Get yarn cache location - id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Install dependencies - run: | - yarn install --no-ignore-optional --frozen-lockfile - # - uses: jakepartusch/wait-for-netlify-action@v1 - # id: wait - # with: - # site_name: "jakejarvis" - - name: Run Lighthouse CI - run: | - npm install -g @lhci/cli@0.3.x - lhci autorun --config=./lighthouserc.json - env: - LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} diff --git a/lighthouserc.json b/lighthouserc.json index af4f2e3e..39418dba 100644 --- a/lighthouserc.json +++ b/lighthouserc.json @@ -1,20 +1,13 @@ { "ci": { "collect": { - "url": [ - "http://localhost:1337/", - "http://localhost:1337/notes/", - "http://localhost:1337/notes/how-to-pull-request-fork-github/", - "http://localhost:1337/notes/how-to-pull-request-fork-github/amp.html" - ], - "numberOfRuns": 1, - "startServerCommand": "yarn start --disableLiveReload", - "startServerReadyPattern": "Web Server is available at" + "numberOfRuns": 1 }, "assert": { "preset": "lighthouse:no-pwa", "assertions": { "color-contrast": ["warn", {"minScore": 0.9}], + "errors-in-console": "warn", "link-text": "warn", "tap-targets": ["warn", {"minScore": 0.6}], "total-byte-weight": ["warn", {"minScore": 0.9}],