11name : Code Coverage
22
3- on :
4- push :
5- branches : [main]
3+ # TODO: revert
4+ on : push
5+ # on:
6+ # push:
7+ # branches: [main]
68
79env :
810 NX_NON_NATIVE_HASHER : true
911 NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1012
1113jobs :
14+ list-packages :
15+ name : List packages
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout the repository
19+ uses : actions/checkout@v4
20+ - name : Set up Node.js
21+ uses : actions/setup-node@v4
22+ with :
23+ node-version-file : .nvmrc
24+ cache : npm
25+ - name : Install dependencies
26+ run : npm ci
27+ - name : List packages using Nx CLI
28+ id : list-packages
29+ run : |
30+ matrix=$(node tools/scripts/create-codecov-matrix.js)
31+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
32+ outputs :
33+ matrix : ${{ steps.list-packages.outputs.matrix }}
34+
1235 coverage :
36+ needs : [list-packages]
1337 strategy :
1438 fail-fast : false
15- matrix :
16- lib :
17- - cli
18- - core
19- - models
20- - utils
21- - plugin-eslint
22- - plugin-coverage
23- - plugin-js-packages
24- - plugin-lighthouse
25- scope : [unit, int]
26- name : Update code coverage
39+ matrix : ${{ fromJson(needs.list-packages.outputs.matrix) }}
40+ name : Collect code coverage
2741 runs-on : ubuntu-latest
2842 steps :
2943 - name : Checkout the repository
@@ -35,13 +49,13 @@ jobs:
3549 cache : npm
3650 - name : Install dependencies
3751 run : npm ci
38- - name : Execute all tests and generate coverage reports
39- run : npx nx run ${{ matrix.lib }}:${{ matrix.scope }}-test --coverage.enabled
52+ - name : Execute tests with coverage
53+ run : npx nx run ${{ matrix.project }}:${{ matrix.target }} --coverage.enabled
4054 - name : Upload coverage reports to Codecov
4155 uses : codecov/codecov-action@v4
4256 with :
43- directory : coverage/${{ matrix.lib }}/${{ matrix.scope }}-tests /
57+ directory : coverage/${{ matrix.project }}/${{ matrix.target }}s /
4458 files : ./lcov.info
45- flags : ${{ matrix.lib }}-${{ matrix.scope }}
59+ flags : ${{ matrix.project }}-${{ matrix.target }}
4660 token : ${{ secrets.CODECOV_TOKEN }}
4761 fail_ci_if_error : true
0 commit comments