@@ -2,15 +2,12 @@ name: Continuous Integration
22
33on :
44 push :
5- branches : [ master ]
5+ branches : [master]
66 pull_request :
7- branches : [ master ]
7+ branches : [master]
88
99permissions : {}
1010
11- env :
12- NODE_OPTIONS : --max-old-space-size=4096
13-
1411jobs :
1512 test :
1613 name : Test
@@ -19,32 +16,70 @@ jobs:
1916 matrix :
2017 os : [ubuntu-latest]
2118 node-version : [20, 22, 24]
22- include :
23- - os : windows-latest
24- node-version : 22 # LTS
25- - os : macos-latest
26- node-version : 22 # LTS
2719 fail-fast : false
2820 runs-on : ${{ matrix.os }}
2921 steps :
3022 - uses : actions/checkout@v4
23+
24+ - name : Set up Docker
25+ uses : docker/setup-buildx-action@v3
26+
27+ - name : Start DB2 container
28+ run : |
29+ docker run -itd --name db2 \
30+ --privileged=true \
31+ -e LICENSE=accept \
32+ -e DB2INST1_PASSWORD=password \
33+ -e DBNAME=testdb \
34+ -p 60000:50000 \
35+ -v db2data:/db2data \
36+ ibmcom/db2
37+
38+ - name : Wait for DB2 instance to be up
39+ run : |
40+ echo "Waiting for DB2 engine to be ready..."
41+ for i in {1..20}; do
42+ docker exec db2 su - db2inst1 -c "db2 connect to sample" >/dev/null 2>&1 && break
43+ echo "Still waiting ($i)..."
44+ sleep 5
45+ done
46+
47+ - name : Wait for testdb to be accessible
48+ run : |
49+ echo "Waiting for testdb..."
50+ for i in {1..20}; do
51+ docker exec db2 su - db2inst1 -c "db2 connect to testdb" >/dev/null 2>&1 && break
52+ echo "Still waiting ($i)..."
53+ sleep 5
54+ done
55+
3156 - name : Use Node.js ${{ matrix.node-version }}
3257 uses : actions/setup-node@v4
3358 with :
3459 node-version : ${{ matrix.node-version }}
35- - run : npm install
60+
61+ - run : npm ci
62+
3663 - name : Run test
3764 run : npm test --ignore-scripts
3865
66+ - name : Dump DB2 logs on failure
67+ if : failure()
68+ run : docker logs db2
69+
70+ - name : Cleanup DB2 container
71+ if : always()
72+ run : docker rm -f db2
73+
3974 code-lint :
4075 name : Code Lint
4176 runs-on : ubuntu-latest
4277 steps :
4378 - uses : actions/checkout@v4
4479 - uses : actions/setup-node@v4
4580 with :
46- node-version : 22 # LTS
47- - run : npm install --ignore-scripts
81+ node-version : 22
82+ - run : npm ci --ignore-scripts
4883 - name : Verify code linting
4984 run : npx --no eslint .
5085
@@ -53,13 +88,12 @@ jobs:
5388 runs-on : ubuntu-latest
5489 if : ${{ github.event.pull_request }}
5590 steps :
56- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91+ - uses : actions/checkout@v4
5792 with :
5893 fetch-depth : 0
59- - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
94+ - uses : actions/setup-node@v4
6095 with :
61- node-version : 22 # LTS
62- - name : Install dependencies
63- run : npm install
96+ node-version : 22
97+ - run : npm ci
6498 - name : Verify commit linting
6599 run : npx commitlint --from origin/master --to HEAD --verbose
0 commit comments