Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] ci(db2): add db2 ci checks #1049

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ on:
pull_request:

jobs:
test-db2:
strategy:
fail-fast: false
matrix:
node-version: [10, 16]
name: DB2 (Node ${{ matrix.node-version }}, Sequelize latest)
runs-on: ubuntu-latest
env:
DIALECT: db2
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile --ignore-engines
- run: yarn add sequelize@latest --ignore-engines
- name: Install Local DB2 Copy
run: yarn start-db2
- run: yarn test
test-postgres:
strategy:
fail-fast: false
Expand Down
15 changes: 15 additions & 0 deletions dev/db2/11.5/.env_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
LICENSE=accept
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=password
DBNAME=testdb
BLU=false
ENABLE_ORACLE_COMPATIBILITY=false
UPDATEAVAIL=NO
TO_CREATE_SAMPLEDB=false
REPODB=false
IS_OSXFS=false
PERSISTENT_HOME=false
HADR_ENABLED=false
ETCD_ENDPOINT=
ETCD_USERNAME=
ETCD_PASSWORD=
29 changes: 29 additions & 0 deletions dev/db2/11.5/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cd dev/db2/11.5
export DIALECT=db2

mkdir -p Docker
if [ ! "$(sudo docker ps -q -f name=db2server)" ]; then
if [ "$(sudo docker ps -aq -f status=exited -f name=db2server)" ];
then
# cleanup
sudo docker rm -f db2server
sudo rm -rf /Docker
fi
sudo docker run -h db2server --name db2server --restart=always --detach --privileged=true -p 50000:50000 --env-file .env_list -v /Docker:/database ibmcom/db2-amd64:11.5.6.0a
count=1
while true
do
if (sudo docker logs db2server | grep 'Setup has completed')
then
sudo docker exec db2server bash -c "su db2inst1 & disown"
break
fi
if ($count -gt 30); then
echo "Error: Db2 docker setup has not completed in 10 minutes."
break
fi
sleep 20
let "count=count+1"
done
echo "Local DB2-11.5 instance is ready for Sequelize tests."
fi
3 changes: 3 additions & 0 deletions dev/db2/11.5/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sudo docker stop db2server

echo "Local Db2 instance stopped (if it was running)."
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"expect.js": "0.3.1",
"gulp": "4.0.2",
"husky": "7.0.4",
"ibm_db": "latest",
"lint-staged": "12.3.5",
"mocha": "9.2.2",
"mysql2": "latest",
Expand All @@ -58,6 +59,8 @@
"lint": "eslint test src",
"pretty": "prettier src test --write",
"prepare": "husky install && npm run build",
"start-db2": "bash dev/db2/11.5/start.sh",
"stop-db2": "bash dev/db2/11.5/stop.sh",
"test-raw": "mocha 'test/**/*.test.js'",
"test": "npm run lint && npm run build && npm run test-raw"
},
Expand Down
36 changes: 36 additions & 0 deletions test/support/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,40 @@ module.exports = {
process.env.SEQ_MYSQL_POOL_IDLE || process.env.SEQ_POOL_IDLE || 3000,
},
},

db2: {
database:
process.env.SEQ_DB2_DB ||
process.env.SEQ_DB ||
process.env.IBM_DB_DBNAME ||
'testdb',
username:
process.env.SEQ_DB2_USER ||
process.env.SEQ_USER ||
process.env.IBM_DB_UID ||
'db2inst1',
password:
process.env.SEQ_DB2_PW ||
process.env.SEQ_PW ||
process.env.IBM_DB_PWD ||
'password',
host:
process.env.DB2_PORT_50000_TCP_ADDR ||
process.env.SEQ_DB2_HOST ||
process.env.SEQ_HOST ||
process.env.IBM_DB_HOSTNAME ||
'127.0.0.1',
port:
process.env.DB2_PORT_50000_TCP_PORT ||
process.env.SEQ_DB2_PORT ||
process.env.SEQ_PORT ||
process.env.IBM_DB_PORT ||
50000,
pool: {
maxConnections:
process.env.SEQ_DB2_POOL_MAX || process.env.SEQ_POOL_MAX || 5,
maxIdleTime:
process.env.SEQ_DB2_POOL_IDLE || process.env.SEQ_POOL_IDLE || 3000,
},
},
};
Loading