ci: add merge coverage job (#37306)

* ci: add merge coverage job

* chore: update
This commit is contained in:
vagusX 2022-08-30 14:40:20 +08:00 committed by GitHub
parent 2910313a47
commit 9c04b4edbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -291,12 +291,18 @@ jobs:
if: ${{ matrix.module == 'dom' }}
run: npm test -- --maxWorkers=2 --shard=${{matrix.shard}} --coverage
- name: coverage
uses: codecov/codecov-action@v3
- name: persist coverages
if: ${{ matrix.module == 'dom' && matrix.react == '17' }}
run: |
mkdir persist-coverage
mv coverage/coverage-final.json persist-coverage/react-${{matrix.react}}-test-${{matrix.module}}-${{strategy.job-index}}.json
- uses: actions/upload-artifact@v3
if: ${{ matrix.module == 'dom' && matrix.react == '17' }}
name: upload coverages
with:
# use own token to upload coverage reports
token: ${{ secrets.CODECOV_TOKEN }}
name: coverage-artifacts
path: persist-coverage/
# node test
- name: node test
@ -311,6 +317,28 @@ jobs:
LIB_DIR: dist
needs: [setup, dist]
############################ Test Coverage ###########################
upload-test-coverage:
name: test-coverage
runs-on: ubuntu-latest
needs: [normal-test]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: coverage-artifacts
path: persist-coverage
- name: Merge Code Coverage
run: |
npx nyc merge persist-coverage/ coverage/coverage-final.json
npx nyc report --reporter text -t coverage --report-dir coverage
rm -rf persist-coverage
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
# use own token to upload coverage reports
token: ${{ secrets.CODECOV_TOKEN }}
########################### Compile & Test ###########################
compile:
runs-on: ubuntu-latest