-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
node-test-coverage
reusable workflow
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Node.js test coverage | ||
on: | ||
workflow_call: | ||
inputs: | ||
nodeVersion: | ||
type: string | ||
default: '18' | ||
required: false | ||
coverageFile: | ||
type: string | ||
default: './coverage/cobertura-coverage.xml' | ||
required: false | ||
secrets: | ||
codecovToken: | ||
description: 'A token passed from the caller workflow' | ||
required: true | ||
jobs: | ||
node-test: | ||
name: Test coverage (Node.js ${{ inputs.nodeVersion }}) | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
- name: Setup Node.js ${{ inputs.nodeVersion }} | ||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3.3.0 | ||
with: | ||
node-version: ${{ inputs.nodeVersion }} | ||
- name: Install project | ||
run: npm ci --ignore-scripts | ||
- name: Test | ||
run: npm test | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # tag=v3.1.1 | ||
with: | ||
token: ${{ secrets.codecovToken }} | ||
file: ./coverage/cobertura-coverage.xml |