Browse Source

ci: use jest shard (#35622)

pull/35822/head
vagusX 3 years ago
committed by GitHub
parent
commit
acdd164a09
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      .github/workflows/test.yml
  2. 2
      package.json
  3. 2
      webpack.config.js

11
.github/workflows/test.yml

@ -138,7 +138,7 @@ jobs:
key: dist-${{ github.sha }}
- name: dist
run: npm run dist
run: CI=1 npm run dist
env:
NODE_OPTIONS: --max_old_space_size=4096
needs: setup
@ -236,6 +236,7 @@ jobs:
matrix:
react: ['16', '17', '18']
module: ['dom', 'node', 'dist']
shard: ['1/4', '2/4', '3/4', '4/4']
env:
REACT: ${{ matrix.react }}
runs-on: ubuntu-latest
@ -288,12 +289,11 @@ jobs:
# dom test
- name: dom test
if: ${{ matrix.module == 'dom' }}
run: npm test -- -w 1 --coverage
run: npm test -- --maxWorkers=2 --shard=${{matrix.shard}} --coverage
# > 17 only
- name: coverage
uses: codecov/codecov-action@v3
if: ${{ matrix.module == 'dom' && matrix.react == '17' }}
run: bash <(curl -s https://codecov.io/bash)
# node test
- name: node test
@ -353,6 +353,7 @@ jobs:
matrix:
react: ['16', '17', '18']
module: [lib, es]
shard: ['1/4', '2/4', '3/4', '4/4']
env:
REACT: ${{ matrix.react }}
steps:
@ -400,7 +401,7 @@ jobs:
- name: test
# lib only run in master branch not in pull request
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
run: npm test
run: npm test -- --maxWorkers=2 --shard=${{matrix.shard}}
env:
LIB_DIR: ${{ matrix.module }}
needs: compile

2
package.json

@ -161,6 +161,7 @@
"devDependencies": {
"@ant-design/bisheng-plugin": "^3.2.0",
"@ant-design/hitu": "^0.0.0-alpha.13",
"@ant-design/jest-image-snapshot": "^4.5.2",
"@ant-design/tools": "^15.0.2",
"@docsearch/css": "^3.0.0",
"@qixian.cs/github-contributors-list": "^1.0.3",
@ -238,7 +239,6 @@
"jest-axe": "^6.0.0",
"jest-environment-jsdom": "^28.0.2",
"jest-environment-node": "^28.0.2",
"@ant-design/jest-image-snapshot": "^4.5.2",
"jest-puppeteer": "^6.0.0",
"jquery": "^3.4.1",
"jsdom": "^19.0.0",

2
webpack.config.js

@ -129,6 +129,7 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
});
}
if (!process.env.CI) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
@ -136,6 +137,7 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
reportFilename: '../report.html',
}),
);
}
if (!process.env.NO_DUP_CHECK) {
config.plugins.push(

Loading…
Cancel
Save