Skip to content

Commit f3b1676

Browse files
authored
Merge pull request #49 from phansys/gh_ci_service
Leverage GitHub actions services instead of manually running the "ibmcom/db2" container
2 parents 236774b + 8517975 commit f3b1676

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ jobs:
1313
matrix:
1414
version: ['7.3', '7.4', '8.0', '8.1', '8.2']
1515
runs-on: ubuntu-latest
16+
services:
17+
ibm_db2:
18+
image: "icr.io/db2_community/db2:11.5.8.0"
19+
env:
20+
DB2INST1_PASSWORD: "password"
21+
LICENSE: "accept"
22+
DBNAME: "sample"
23+
options: "--privileged=true"
24+
ports:
25+
- "60000:50000"
26+
volumes:
27+
- database:/database
1628
steps:
1729
- name: Checkout
1830
uses: actions/checkout@v3
@@ -50,25 +62,7 @@ jobs:
5062
run: ./configure --with-IBM_DB2=$PWD/clidriver
5163
- name: make
5264
run: make V=1
53-
- name: Cache container
54-
id: cache-docker
55-
uses: actions/cache@v2
56-
with:
57-
path: image-cache
58-
key: ${{ runner.os }}-image-cache
59-
- name: Download container
60-
if: steps.cache-docker.outputs.cache-hit != 'true'
61-
run: |
62-
docker pull icr.io/db2_community/db2:11.5.8.0
63-
mkdir image-cache
64-
docker save -o image-cache/db2.tar icr.io/db2_community/db2:11.5.8.0
65-
- name: Restore container from cache
66-
if: steps.cache-docker.outputs.cache-hit == 'true'
67-
run: docker load -i image-cache/db2.tar
6865
- name: Set up Db2 LUW in Docker
69-
# XXX: Should we be caching the Docker image? Are we creating the necessary things?
70-
# Adapted from the Travis setup with the changes used for the current
71-
# version of the Db2 container.
7266
run: |
7367
set -x
7468
cat <<EOF > db2cli.ini
@@ -79,16 +73,8 @@ jobs:
7973
Database=sample
8074
EOF
8175
mkdir database
82-
docker run --name db2 --privileged=true -p 60000:50000 -e DB2INST1_PASSWORD=password -e LICENSE=accept -e DBNAME=sample -v database:/database -itd icr.io/db2_community/db2:11.5.8.0
83-
docker ps -as
84-
while true
85-
do
86-
if (docker logs db2 | grep 'Setup has completed')
87-
then
88-
break
89-
fi
90-
sleep 20
91-
done
76+
- name: "Perform healthcheck on db2 service"
77+
run: "docker logs -f ${{ job.services.ibm_db2.id }} | sed '/(*) Setup has completed./ q'"
9278
- name: Tests
9379
# make test is insufficient to load PDO
9480
# Most of these are either cribbed from the old Travis configuration,

0 commit comments

Comments
 (0)