Skip to content

Commit bad6e61

Browse files
committed
Add matrix tests for node runtime versions (#50)
- Bump version of cache action to v4
1 parent 33d3109 commit bad6e61

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
echo "EMSDK_VERSION=$EMSDK_VERSION" >> $GITHUB_ENV
1717
1818
- name: Cache build artifacts
19-
uses: actions/cache@v2
19+
uses: actions/cache@v4
2020
with:
2121
path: dist
2222
key: cache-build-artifacts-${{ github.sha }}
@@ -40,17 +40,45 @@ jobs:
4040

4141
- name: Build and Test
4242
run: make fmt-check lint-check test package
43+
44+
matrix-tests:
45+
name: Test Node versions
46+
runs-on: ubuntu-latest
47+
needs: build
48+
strategy:
49+
matrix:
50+
node_version: [16, 18, 20]
51+
steps:
52+
- uses: actions/checkout@v2
53+
54+
- name: Cache build artifacts
55+
uses: actions/cache@v4
56+
with:
57+
path: dist
58+
key: cache-build-artifacts-${{ github.sha }}
59+
60+
- name: Setup Node
61+
uses: actions/setup-node@v2
62+
with:
63+
node-version: ${{ matrix.node_version }}
64+
65+
- name: Install dependencies
66+
run: npm install glob@"$(jq -r .devDependencies.glob package.json)" jest@"$(jq -r .devDependencies.jest package.json)"
67+
68+
- name: Test
69+
run: make matrix-test
70+
4371
publish:
4472
name: Publish
4573
environment: Publish
46-
needs: build
74+
needs: [build, matrix-tests]
4775
runs-on: ubuntu-latest
4876
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' )
4977
steps:
5078
- uses: actions/checkout@v2
5179

5280
- name: Cache build artifacts
53-
uses: actions/cache@v2
81+
uses: actions/cache@v4
5482
with:
5583
path: dist
5684
key: cache-build-artifacts-${{ github.sha }}

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export EMCC_CFLAGS = -msimd128 -O2
1010
test: dist/index.js dist/test/integration/foobar_magic dist/test/integration/png_magic dist/test/integration/jpeg_magic
1111
TZ='UTC' npm run test
1212

13+
matrix-test: vendor/file/COPYING
14+
TZ='UTC' npm run test
15+
1316
dist/test/integration/foobar_magic dist/test/integration/png_magic dist/test/integration/jpeg_magic &:
1417
mkdir -p dist/test/integration \
1518
&& cp src/test/integration/*_magic dist/test/integration/

0 commit comments

Comments
 (0)