-
Notifications
You must be signed in to change notification settings - Fork 405
48 lines (45 loc) · 1.39 KB
/
unit-tests.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
name: Unit Tests
on:
workflow_call:
env:
NPM_VERSION: 8.15.0
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install higher version of NPM
run: npm install -g npm@${{ env.NPM_VERSION }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
key: ${{ matrix.node-version }}-npm-cache-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ matrix.node-version }}-npm-cache-
- name: Check correct usage of Caliper package names
run: ./scripts/check-package-names.sh
- name: Install project dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Check the version consistency of subpackages
run: ./packages/caliper-publish/publish.js version check
- name: Run unit tests
run: npm test --workspaces
- name: Upload coverage reports artifact
if: matrix.node-version == '18.x'
uses: actions/[email protected]
with:
name: coverage-reports
path: packages/*/coverage/clover.xml