Skip to content

Commit

Permalink
build(gha): fix matrix node version
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jul 12, 2024
1 parent 2b25959 commit 76059c9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,45 @@ jobs:
test:
name: 'Run unit tests'
runs-on: ubuntu-22.04
env:
DEFAULT_NODE_VERSION: 20
strategy:
matrix:
node-version: [18, 20]
node-version: [18, 'current']
steps:
- uses: actions/checkout@v4

- name: 'Handle coverage cache'
if: matrix.node-version == vars.NODE_VERSION
if: matrix.node-version == 'current'
uses: actions/cache@v4
id: coverage-cache
with:
path: coverage/clover.xml
key: coverage-${{ hashFiles('package.json', 'yarn.lock', 'tsconfig.json', 'src/**/*', 'test/**/*') }}

- uses: myparcelnl/actions/yarn-install@v4
if: matrix.node-version != env.DEFAULT_NODE_VERSION || steps.coverage-cache.outputs.cache-hit != 'true'
if: steps.coverage-cache.outputs.cache-hit != 'true'
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node-version == 'current' && '' || matrix.node-version }}

- name: 'Run typecheck'
if: matrix.node-version == env.DEFAULT_NODE_VERSION && steps.coverage-cache.outputs.cache-hit != 'true'
if: matrix.node-version == 'current' && steps.coverage-cache.outputs.cache-hit != 'true'
#language=sh
run: |
yarn run typecheck
- name: 'Run tests with coverage'
if: matrix.node-version == env.DEFAULT_NODE_VERSION && steps.coverage-cache.outputs.cache-hit != 'true'
if: matrix.node-version == 'current' && steps.coverage-cache.outputs.cache-hit != 'true'
#language=sh
run: |
yarn test:coverage
- name: 'Run tests'
if: matrix.node-version != env.DEFAULT_NODE_VERSION
if: matrix.node-version != 'current'
#language=sh
run: |
yarn test:run
- uses: codecov/codecov-action@v4
if: matrix.node-version == env.DEFAULT_NODE_VERSION
if: matrix.node-version == 'current'
with:
files: coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 76059c9

Please sign in to comment.