-
Notifications
You must be signed in to change notification settings - Fork 39
115 lines (99 loc) · 3.41 KB
/
unit-test.yml
File metadata and controls
115 lines (99 loc) · 3.41 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: 🧪 Unit tests
on:
workflow_call: {}
permissions:
contents: read
id-token: write
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- node-version: 16.x
instrumentation: "current"
mode: "cjs"
- node-version: 18.x
instrumentation: "current"
mode: "cjs"
- node-version: 20.x
instrumentation: "current"
mode: "cjs"
- node-version: 22.x
instrumentation: "current"
mode: "cjs"
- node-version: 24.x
instrumentation: "current"
mode: "cjs"
- node-version: 24.x
instrumentation: "new"
mode: "cjs"
- node-version: 24.x
instrumentation: "new"
mode: "esm"
- node-version: 25.x
instrumentation: "current"
mode: "cjs"
- node-version: 25.x
instrumentation: "new"
mode: "cjs"
- node-version: 25.x
instrumentation: "new"
mode: "esm"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Setup Aikido safe-chain
run: |
npm i -g @aikidosec/safe-chain
safe-chain setup-ci
- name: Downgrade npm for v24 and v25
# https://github.com/npm/cli/issues/8669
if: ${{ matrix.node-version == '24.x' || matrix.node-version == '25.x' }}
run: npm i -g npm@11.6.0
- name: Add local.aikido.io to /etc/hosts
run: |
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
- name: Install dependencies (library only)
run: npm run install-lib-only
- name: Start containers
run: npm run containers
- name: Download build artifacts
uses: actions/download-artifact@v5
with:
name: firewall-node-library-${{ github.sha }}
- name: Run tests with current instrumentation (max 3 attempts)
if: ${{ matrix.instrumentation == 'current' }}
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
timeout_minutes: 15
max_attempts: 3
command: npm run test:ci
- name: Run tests with new instrumentation in CJS mode (max 3 attempts)
if: ${{ matrix.instrumentation == 'new' && matrix.mode == 'cjs' }}
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
timeout_minutes: 15
max_attempts: 3
command: npm run test:ci:new
- name: Run tests in ESM mode (max 3 attempts)
if: ${{ matrix.instrumentation == 'new' && matrix.mode == 'esm' }}
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
timeout_minutes: 15
max_attempts: 3
command: npm run test:esm
- name: Upload coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: ./library/.tap/report/lcov.info,./.esm-tests/tests/lcov.info
use_oidc: true
fail_ci_if_error: true