main
  1name: Test
  2
  3on:
  4  push:
  5  pull_request:
  6  schedule:
  7    - cron: '0 12 */4 * *'
  8
  9permissions:
 10  contents: read
 11
 12env:
 13  npm_config_audit: false
 14  npm_config_fund: false
 15  npm_config_save: false
 16  npm_config_package_lock: false
 17
 18jobs:
 19  build:
 20    runs-on: ubuntu-latest
 21    steps:
 22      - uses: actions/checkout@v5
 23        with:
 24          persist-credentials: false
 25
 26      - name: Use Node.js 24
 27        uses: actions/setup-node@v5
 28        with:
 29          node-version: 24
 30          cache: 'npm'
 31
 32      - run: npm ci
 33      - run: |
 34          npm run build
 35          cd build && ls -l
 36      - uses: actions/upload-artifact@v4
 37        with:
 38          name: build
 39          path: |
 40            build
 41            jsr.json
 42            package.json
 43            package-lite.json
 44            package-main.json
 45          retention-days: 1
 46
 47  checks:
 48    needs: build
 49    runs-on: ubuntu-latest
 50    steps:
 51      - uses: actions/checkout@v5
 52        with:
 53          persist-credentials: false
 54          fetch-depth: ${{ github.event_name == 'pull_request' && '15' || '1' }} # to ensure we have enough history for commitlint
 55
 56      - name: Use Node.js 24
 57        uses: actions/setup-node@v5
 58        with:
 59          node-version: 24
 60          cache: 'npm'
 61
 62      - uses: actions/download-artifact@v5
 63        with:
 64          name: build
 65      - run: npm ci
 66
 67      - name: Format
 68        run: npm run fmt:check
 69
 70      - name: License
 71        run: npm run test:license
 72
 73      - name: Size
 74        run: npm run test:size
 75
 76      - name: Dep audit
 77        run: npm run test:audit
 78
 79      - name: Circular
 80        run: npm run test:circular
 81
 82      - name: Bundles
 83        run: npm run test:npm
 84        timeout-minutes: 1
 85
 86      - name: JSR dry-run
 87        run: npm run test:jsr
 88
 89      - name: Conventional Commits
 90        if: github.event_name == 'pull_request'
 91        env:
 92          BASE_SHA: ${{ github.event.pull_request.base.sha }}
 93          HEAD_SHA: ${{ github.event.pull_request.head.sha }}
 94        run: npx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose
 95
 96  test:
 97    needs: build
 98    runs-on: ubuntu-latest
 99    env:
100      FORCE_COLOR: 3
101
102    steps:
103      - uses: actions/checkout@v5
104        with:
105          persist-credentials: false
106
107      - name: Use Node.js 24
108        uses: actions/setup-node@v5
109        with:
110          node-version: 24
111          cache: 'npm'
112
113      - uses: actions/download-artifact@v5
114        with:
115          name: build
116      - run: npm ci
117
118      - name: Unit tests
119        run: npm run test:coverage
120        timeout-minutes: 1
121
122      - name: Type tests
123        run: npm run test:types
124
125  docker-test:
126    needs: build
127    runs-on: ubuntu-latest
128    steps:
129      - uses: actions/checkout@v5
130        with:
131          persist-credentials: false
132
133      - uses: actions/download-artifact@v5
134        with:
135          name: build
136      - run: |
137          npm run build:dcr
138          npm run test:dcr
139
140  smoke-win32-node16:
141    strategy:
142      matrix:
143        os: [windows-2022, windows-2025]
144    name: smoke-${{ matrix.os }}-node16
145    runs-on: ${{ matrix.os }}
146    needs: build
147    steps:
148      - uses: actions/checkout@v5
149        with:
150          persist-credentials: false
151
152      - name: Use Node.js 16
153        uses: actions/setup-node@v5
154        with:
155          node-version: 16
156          cache: 'npm'
157
158      - uses: actions/download-artifact@v5
159        with:
160          name: build
161
162      - run: npm run test:smoke:win32
163        timeout-minutes: 2
164        env:
165          FORCE_COLOR: 3
166
167  smoke-bun:
168    runs-on: ubuntu-latest
169    needs: build
170    steps:
171      - uses: actions/checkout@v5
172        with:
173          persist-credentials: false
174
175      - name: Setup Bun
176        uses: antongolub/action-setup-bun@f0b9f339a7ce9ba1174a58484e4dc9bbd6f7b133 # v1.13.2
177      - uses: actions/download-artifact@v5
178        with:
179          name: build
180      - run: |
181          bun test ./test/smoke/bun.test.js
182          bun ./test/smoke/ts.test.ts
183        timeout-minutes: 1
184        env:
185          FORCE_COLOR: 3
186
187  smoke-deno:
188    runs-on: ubuntu-latest
189    needs: build
190    name: smoke-deno${{ matrix.deno-version }}
191    strategy:
192      matrix:
193        deno-version: [1, 2]
194    steps:
195      - uses: actions/checkout@v5
196        with:
197          persist-credentials: false
198      - name: Setup Deno
199        uses: denoland/setup-deno@909cc5acb0fdd60627fb858598759246509fa755 # v2.0.2
200        with:
201          deno-version: ${{ matrix.deno-version }}
202      - run: deno install npm:types/node npm:types/fs-extra
203      - uses: actions/download-artifact@v5
204        with:
205          name: build
206      - run: deno test --allow-read --allow-sys --allow-env --allow-run ./test/smoke/deno.test.js
207        timeout-minutes: 1
208        env:
209          FORCE_COLOR: 3
210
211  smoke-node:
212    runs-on: ubuntu-latest
213    needs: build
214    name: smoke-node${{ matrix.node-version }}
215    strategy:
216      matrix:
217        node-version: [12, 14, 16, 18, 20, 22, 24, 25-nightly]
218    steps:
219      - uses: actions/checkout@v5
220        with:
221          persist-credentials: false
222      - name: Use Node.js ${{ matrix.node-version }}
223        uses: actions/setup-node@v5
224        with:
225          node-version: ${{ matrix.node-version }}
226          cache: 'npm'
227      - uses: actions/download-artifact@v5
228        with:
229          name: build
230      - name: cjs smoke test
231        run: npm run test:smoke:cjs
232      - name: mjs smoke test
233        run: npm run test:smoke:mjs
234      - name: strip-types
235        if: matrix.node-version >= 22
236        run: npm run test:smoke:strip-types
237
238  smoke-graal:
239    needs: build
240    runs-on: ubuntu-latest
241    name: smoke-graal${{ matrix.version }}
242    strategy:
243      matrix:
244        version: [17, 20]
245    steps:
246      - uses: actions/checkout@v5
247        with:
248          persist-credentials: false
249      - uses: graalvm/setup-graalvm@7f61f4917e70cddcfee9df637f280f10d5ae3566 #v1
250        with:
251          java-version: ${{ matrix.version }}
252          distribution: 'graalvm-community'
253          components: 'nodejs'
254          github-token: ${{ secrets.GITHUB_TOKEN }}
255      - uses: actions/download-artifact@v5
256        with:
257          name: build
258      - name: smoke tests
259        run: |
260          which node
261          node -v
262          npm run test:smoke:cjs
263
264  smoke-ts:
265    runs-on: ubuntu-latest
266    needs: build
267    name: smoke-ts${{ matrix.ts }}
268    strategy:
269      matrix:
270        ts: [4, 5, rc, next]
271    steps:
272      - uses: actions/checkout@v5
273        with:
274          persist-credentials: false
275      - name: Use Node.js 24
276        uses: actions/setup-node@v5
277        with:
278          node-version: 24
279          cache: 'npm'
280
281      - name: Install deps
282        run: npm ci
283      - name: Install TypeScript ${{ matrix.ts }}
284        run: npm i --force typescript@${{ matrix.ts }}
285      - name: Override @types/node
286        if: matrix.ts == 4
287        run: npm i --force @types/node@24.2.0
288
289      - uses: actions/download-artifact@v5
290        with:
291          name: build
292      - name: tsc
293        run: npm run test:smoke:tsc
294      - name: tsx
295        run: npm run test:smoke:tsx
296      - name: ts-node
297        run: npm run test:smoke:ts-node