@@ -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
@@ -23,38 +20,65 @@ jobs:
2320 runs-on : ${{ matrix.os }}
2421 steps :
2522 - uses : actions/checkout@v4
23+
2624 - name : Set up Docker
2725 uses : docker/setup-buildx-action@v3
26+
2827 - name : Start DB2 container
2928 run : |
30- docker run -d --name db2 -e ACCEPT_EULA=TRUE -e LICENSE=accept -p 60000:50000 -v db2data:/db2data ibmcom/db2
31- - name : Wait for DB2 to be ready
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
3248 run : |
33- echo "Waiting for DB2 to start..."
34- for i in {1..200}; do
35- if docker exec db2 su - db2inst1 -c 'db2 get instance' > /dev/null 2>&1; then
36- echo "DB2 is ready!"
37- break
38- fi
39- echo "Still waiting... ($i)"
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)..."
4053 sleep 5
4154 done
55+
4256 - name : Use Node.js ${{ matrix.node-version }}
4357 uses : actions/setup-node@v4
4458 with :
4559 node-version : ${{ matrix.node-version }}
60+
4661 - run : npm ci
62+
4763 - name : Run test
4864 run : npm test --ignore-scripts
4965
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+
5074 code-lint :
5175 name : Code Lint
5276 runs-on : ubuntu-latest
5377 steps :
5478 - uses : actions/checkout@v4
5579 - uses : actions/setup-node@v4
5680 with :
57- node-version : 22 # LTS
81+ node-version : 22
5882 - run : npm ci --ignore-scripts
5983 - name : Verify code linting
6084 run : npx --no eslint .
@@ -64,13 +88,12 @@ jobs:
6488 runs-on : ubuntu-latest
6589 if : ${{ github.event.pull_request }}
6690 steps :
67- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91+ - uses : actions/checkout@v4
6892 with :
6993 fetch-depth : 0
70- - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
94+ - uses : actions/setup-node@v4
7195 with :
72- node-version : 22 # LTS
73- - name : Install dependencies
74- run : npm ci
96+ node-version : 22
97+ - run : npm ci
7598 - name : Verify commit linting
7699 run : npx commitlint --from origin/master --to HEAD --verbose
0 commit comments