Skip to content

Commit

Permalink
[ci] run unit tests in test job, collect coverage in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhyde committed Nov 28, 2023
1 parent 534007b commit d9539bb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ on:
- '*.md'

jobs:
test:
build:
name: node@${{ matrix.node-version }}
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['18', '20', '21']
node-version:
- 18
- 20
- 21

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
Expand All @@ -22,11 +25,7 @@ jobs:
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run check
- run: npm run test:unit
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
- run: npm run build
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

permissions:
Expand All @@ -13,10 +15,13 @@ jobs:

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version-file: 'package.json'
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- run: npm publish --provenance --access public
env:
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:

jobs:
test:
name: ${{ matrix.os-release }}-node@${{ matrix.node-version }}
runs-on: ${{ matrix.os-release }}

strategy:
matrix:
node-version:
Expand All @@ -20,9 +23,6 @@ jobs:
- ubuntu-latest
- windows-latest

runs-on: ${{ matrix.os-release }}
name: ${{ matrix.os-release }}-node@${{ matrix.node-version }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
Expand All @@ -31,6 +31,20 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run test

coverage:
name: collect coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version-file: 'package.json'

- run: npm ci

- run: npm run test:unit
Expand Down

0 comments on commit d9539bb

Please sign in to comment.