Skip to content

Commit

Permalink
chore(ci): lighthouse (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
shijiatongxue authored Dec 8, 2021
1 parent bf853a8 commit fb91638
Show file tree
Hide file tree
Showing 8 changed files with 1,406 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
overrides: [
{
files: ['*.js', '*.jsx'],
extends: ['jest-enzyme', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:import/errors', 'plugin:import/warnings'],
extends: ['jest-enzyme', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:import/errors', 'plugin:import/warnings', 'plugin:jsx-a11y/recommended'],
parser: '@babel/eslint-parser',
plugins: ['react', 'react-hooks', 'jest', 'import'],
rules: {
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'lighthouse test'

on:
pull_request:
branches: [ main, release, milestone** ]
push:
branches: [ main, release, milestone**, feat/a11y-ci ]

jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: npm install, build
run: |
npm i -g lerna gulp
lerna bootstrap
lerna run build:lib
npm run build-storybook
- name: run Lighthouse CI
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
npm install -g @lhci/[email protected]
lhci autorun
18 changes: 18 additions & 0 deletions .lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

/**
* lighthouse config
* https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md
*/
module.exports = {
ci: {
collect: {
staticDistDir: './storybook-static',
url: ['http://localhost/iframe.html?id=base--semi-a-11-y&args=&viewMode=story'],
isSinglePageApplication: true,
},
upload: {
target: "temporary-public-storage",
},
},
};

1 change: 1 addition & 0 deletions .storybook/base/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
optimizationLevel: 3,
},
},
'@storybook/addon-a11y'
],
webpackFinal: async (config) => {
const rules =
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"@commitlint/config-conventional": "^7.6.0",
"@octokit/rest": "^18.12.0",
"@shopify/jest-dom-mocks": "^2.11.7",
"@storybook/addon-a11y": "^6.3.12",
"@storybook/addon-actions": "^6.3.7",
"@storybook/addon-knobs": "^6.3.1",
"@storybook/builder-webpack5": "^6.4.0-alpha.29",
Expand Down Expand Up @@ -150,6 +151,7 @@
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-markdown": "^2.2.1",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"fs-extra": "^8.1.0",
Expand Down
Loading

0 comments on commit fb91638

Please sign in to comment.