-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (42 loc) · 1.44 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: '🔸 Run tests 🧪'
on:
workflow_call:
jobs:
test:
name: 'Run unit tests'
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [18, 20]
steps:
- uses: actions/checkout@v4
- name: 'Handle coverage cache'
if: matrix.node-version == vars.NODE_VERSION
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 != vars.NODE_VERSION || steps.coverage-cache.outputs.cache-hit != 'true'
with:
node-version: ${{ matrix.node-version }}
- name: 'Run typecheck'
if: matrix.node-version == vars.NODE_VERSION && steps.coverage-cache.outputs.cache-hit != 'true'
run: |
yarn run typecheck
- name: 'Run tests with coverage'
if: matrix.node-version == vars.NODE_VERSION && steps.coverage-cache.outputs.cache-hit != 'true'
#language=sh
run: |
yarn test:coverage
- name: 'Run tests'
if: matrix.node-version != vars.NODE_VERSION
#language=sh
run: |
yarn test:run
- uses: codecov/codecov-action@v4
if: matrix.node-version == vars.NODE_VERSION
with:
files: coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}