Browse Source

test: Update lighthouse-ci.yml (#24598)

* Update lighthouse-ci.yml

* Create lighthouserc.js

* Update index.js

* Add url

* fix url

* fix assertions
pull/24603/head
偏右 5 years ago
committed by GitHub
parent
commit
31fa14a742
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      .github/workflows/lighthouse-ci.yml
  2. 19
      lighthouserc.js
  3. 2
      scripts/test-all.sh

29
.github/workflows/lighthouse-ci.yml

@ -1,24 +1,11 @@
name: Lighthouse Check
on: [pull_request]
name: CI
on: [push]
jobs:
lighthouse-check:
lighthouseci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: mkdir /tmp/artifacts
- name: Run Lighthouse
uses: foo-software/lighthouse-check-action@master
id: lighthouseCheck
with:
accessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: /tmp/artifacts
emulatedFormFactor: desktop
timeout: 1200
prCommentEnabled: false
urls: 'https://preview-${{ github.event.pull_request.number }}-ant-design.surge.sh,https://preview-${{ github.event.pull_request.number }}-ant-design.surge.sh/components/button'
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: Lighthouse reports
path: /tmp/artifacts
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm install && npm install -g @lhci/cli@0.4.x
- run: npm run site
- run: lhci autorun --upload.target=temporary-public-storage

19
lighthouserc.js

@ -0,0 +1,19 @@
module.exports = {
ci: {
collect: {
staticDistDir: './_site',
url: ['http://localhost/', 'http://localhost/components/button/'],
},
upload: {
target: 'temporary-public-storage',
},
assert: {
assertions: {
'categories:performance': ['error', { minScore: 0.1 }],
'categories:accessibility': ['error', { minScore: 0.6 }],
'categories:best-practices': ['error', { minScore: 0.6 }],
'categories:seo': ['error', { minScore: 0.6 }],
},
},
},
};

2
scripts/test-all.sh

@ -1,5 +1,7 @@
#!/bin/sh
cho "[TEST ALL] check-commit" && \
npm run check-commit
echo "[TEST ALL] lint" && \
npm run lint && \
echo "[TEST ALL] dist" && \

Loading…
Cancel
Save