Skip to content

Only run the upload code coverage step for 1 matrix permutation #214

Only run the upload code coverage step for 1 matrix permutation

Only run the upload code coverage step for 1 matrix permutation #214

Workflow file for this run

name: Tests
on:
push:
branches:
- master
pull_request:
env:
FORCE_COLOR: 2
permissions:
contents: read
code-quality: write
jobs:
run:
name: Node.js ${{ matrix.node }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: [12, 14, 16, 18, 20, 22, 24, 25]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
- os: macos-latest
node: 12
- os: macos-latest
node: 14
steps:
- name: Clone repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: package.json
- name: Update npm
if: matrix.node == 12 || matrix.node == 14
run: npm install -g npm@8
- name: Install npm dependencies
run: npm install
- name: Run tests
run: npm run test:ci
- name: Upload coverage report
# Only upload coverage report for Ubuntu and Node.js 25 (latest version), and only if the event is not a pull request or if the pull request is from the same repository.
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 25 && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: actions/upload-code-coverage@v1
continue-on-error: true
with:
file: coverage/cobertura-coverage.xml
language: JavaScript
label: code-coverage/nyc
fail-on-error: false