Skip to content

Commit 874e0d7

Browse files
committed
feat: simpler unit testing
1 parent 414bcb1 commit 874e0d7

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

.github/workflows/test-on-push-and-pr.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ on:
77
branches: [ '*' ]
88

99
jobs:
10-
build:
10+
unit-test:
1111
runs-on: ubuntu-latest
12-
12+
strategy:
13+
matrix:
14+
node-version: [18, 20, 22]
15+
1316
steps:
14-
- uses: actions/checkout@v2
15-
- name: Run 'pr' target
16-
run: make pr
17+
- uses: actions/checkout@v3
18+
- name: Build and run tests for Node.js ${{ matrix.node-version }}
19+
run: |
20+
docker build -f test/unit/Dockerfile.nodejs.${{ matrix.node-version }}x -t unit/nodejs.${{ matrix.node-version }}x .
21+
docker run unit/nodejs.${{ matrix.node-version }}x
1722
1823
alpine:
1924
runs-on: ubuntu-latest

test/unit/Dockerfile.nodejs18.x

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:18
2+
RUN apt-get update
3+
RUN apt-get install -y cmake
4+
WORKDIR /tmp
5+
COPY . /tmp
6+
RUN npm install --ci
7+
CMD ["npm", "run", "test"]

test/unit/Dockerfile.nodejs20.x

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:20
2+
RUN apt-get update
3+
RUN apt-get install -y cmake
4+
WORKDIR /tmp
5+
COPY . /tmp
6+
RUN npm install --ci
7+
CMD ["npm", "run", "test"]

test/unit/Dockerfile.nodejs22.x

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:22
2+
RUN apt-get update
3+
RUN apt-get install -y cmake
4+
WORKDIR /tmp
5+
COPY . /tmp
6+
RUN npm install --ci
7+
CMD ["npm", "run", "test"]

0 commit comments

Comments
 (0)