99 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1010
1111jobs:
12+ list-packages:
13+ name: List packages
14+ runs-on: ubuntu-latest
15+ steps:
16+ - name: Checkout the repository
17+ uses: actions/checkout@v4
18+ - name: Set up Node.js
19+ uses: actions/setup-node@v4
20+ with:
21+ node-version-file: .nvmrc
22+ cache: npm
23+ - name: Install dependencies
24+ run: npm ci
25+ - name: List packages using Nx CLI
26+ id: list-packages
27+ run: |
28+ matrix=$(node tools/scripts/create-codecov-matrix.js)
29+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
30+ outputs:
31+ matrix: ${{ steps.list-packages.outputs.matrix }}
32+
1233 coverage:
34+ needs: [list-packages]
1335 strategy:
1436 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
37+ matrix: ${{ fromJson(needs.list-packages.outputs.matrix) }}
38+ name: Collect code coverage
2739 runs-on: ubuntu-latest
2840 steps:
2941 - name: Checkout the repository
@@ -35,13 +47,13 @@ jobs:
3547 cache: npm
3648 - name: Install dependencies
3749 run: npm ci
38- - name: Execute all tests and generate coverage reports
39- run: npx nx run ${{ matrix.lib }}:${{ matrix.scope }}-test --coverage.enabled
50+ - name: Execute tests with coverage
51+ run: npx nx run ${{ matrix.project }}:${{ matrix.target }} --coverage.enabled
4052 - name: Upload coverage reports to Codecov
4153 uses: codecov/codecov-action@v4
4254 with:
43- directory: coverage/${{ matrix.lib }}/${{ matrix.scope }}-tests /
55+ directory: coverage/${{ matrix.project }}/${{ matrix.target }}s /
4456 files: ./lcov.info
45- flags: ${{ matrix.lib }}-${{ matrix.scope }}
57+ flags: ${{ matrix.project }}-${{ matrix.target }}
4658 token: ${{ secrets.CODECOV_TOKEN }}
4759 fail_ci_if_error: true
0 commit comments