Skip to content

refactor: remove target generator in favour of task inference (#1110) #524

refactor: remove target generator in favour of task inference (#1110)

refactor: remove target generator in favour of task inference (#1110) #524

Workflow file for this run

name: Code Coverage
on:
push:
branches: [main]
env:
NX_NON_NATIVE_HASHER: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
list-packages:
name: List packages
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install dependencies
run: npm ci
- name: List packages using Nx CLI
id: list-packages
run: |
matrix=$(node tools/scripts/create-codecov-matrix.js)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.list-packages.outputs.matrix }}
coverage:
needs: [list-packages]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.list-packages.outputs.matrix) }}
name: Collect code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install dependencies
run: npm ci
- name: Execute tests with coverage
run: npx nx run ${{ matrix.project }}:${{ matrix.target }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
directory: coverage/${{ matrix.project }}/${{ matrix.target }}s/
files: ./lcov.info
flags: ${{ matrix.project }}-${{ matrix.target }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true