Skip to content

Commit

Permalink
ci(ghaction): use shell script test harness
Browse files Browse the repository at this point in the history
Signed-off-by: Rifa Achrinza <[email protected]>
  • Loading branch information
achrinza committed Nov 3, 2024
1 parent aecb0ef commit 6fd4e46
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- 20
- 22
db2-version:
- :11.5.9.0@sha256:77095d4e04cf4448c0257086afcb2c166193d718dc33441da3b949f97e21efd5
- ':11.5.9.0@sha256:77095d4e04cf4448c0257086afcb2c166193d718dc33441da3b949f97e21efd5'
steps:
- name: Harden runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
Expand All @@ -103,18 +103,16 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
submodules: true
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22
cache: npm
- name: Bootstrap dependencies
run: npm ci
- name: Run test harness
uses: ./test
with:
node-version: ${{ github.matrix.node-version }}
db2-version: ${{ github.matrix.db2-version }}
env:
DB2_VERSION: ${{ matrix.db2-version }}
run: ./cicd/well-known/test-harness.sh
test-db2:
name: Cross-test [IBM DB->DB2 LUW]
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -151,5 +149,5 @@ jobs:
- name: Run test harness
uses: loopbackio/loopback-connector-db2/test@ci/ghaction-test
with:
node-version: ${{ github.matrix.node-version }}
db2-version: ${{ github.matrix.db2-version }}
node-version: ${{ matrix.node-version }}
db2-version: ${{ matrix.db2-version }}
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
branches:
only:
- master
language: node_js
os:
- linux
dist: jammy
arch:
- arm64
Expand All @@ -14,5 +15,7 @@ node_js:
- 18
- 20
- 22
env:
- DB2_VERSION=:11.5.9.0@sha256:77095d4e04cf4448c0257086afcb2c166193d718dc33441da3b949f97e21efd5
install: skip
script: ./cicd/well-known/test-harness.sh
15 changes: 12 additions & 3 deletions cicd/well-known/test-harness.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ export DB2_HOSTNAME=localhost
export DB2_PORTNUM=50000
export DB2_DATABASE=mydb

ORIG_DIR="$(pwd)"
cd "$(dirname "$0")/../.."
BASE_DIR="$(pwd)"

CI_NODEJS_AUTOINSTALL_DIR="${CI_NODEJSAUTOINSTALL_DIR:-}"
STARTDB2_SCRIPT="$(dirname "$0")/../vendor/setup-db2/start-db2.sh"
STARTDB2_SCRIPT="$BASE_DIR/cicd/vendor/setup-db2/start-db2.sh"

STEP_COUNT=1

step () {
printf "\n\n============================================================================\n"
printf 'STEP #%d: %s' "$STEP_COUNT\n" "$1"
printf 'STEP #%d: %s\n' "$STEP_COUNT" "$1"
printf "\n============================================================================\n\n"
STEP_COUNT="$((STEP_COUNT + 1))"
}
Expand All @@ -34,10 +38,15 @@ fi
npm install --prefer-offline

step 'Start DB2 LUW server'
"STARTDB2_SCRIPT" \
"$STARTDB2_SCRIPT" \
-l accept \
-V "$DB2_VERSION" \
-p 'P00lGnorts'

step 'Run tests'
npm test --ignore-scripts

step 'Teardown DB2 LUW server'
"$STARTDB2_SCRIPT" -C

cd "$ORIG_DIR"

0 comments on commit 6fd4e46

Please sign in to comment.