Skip to content

Commit cfa3279

Browse files
merge integration tests workflows
1 parent 9bbd06c commit cfa3279

4 files changed

Lines changed: 152 additions & 175 deletions

File tree

.github/workflows/application-management-integration-tests.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

.github/workflows/integration-test.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Comprehensive Integration Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
inputs:
9+
node-version:
10+
description: 'Node.js version'
11+
required: true
12+
type: choice
13+
default: 'all'
14+
options:
15+
- 'all'
16+
- '20'
17+
- '22'
18+
- '24'
19+
20+
jobs:
21+
generate-matrix:
22+
name: Generate Test Matrix
23+
runs-on: ubuntu-latest
24+
outputs:
25+
test-suites: ${{ steps.set-matrix.outputs.test-suites }}
26+
node-versions: ${{ steps.set-node-versions.outputs.node-versions }}
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v5
31+
32+
- name: Set Node versions
33+
id: set-node-versions
34+
run: |
35+
if [ "${{ github.event.inputs.node-version }}" == "all" ] || [ -z "${{ github.event.inputs.node-version }}" ]; then
36+
echo "node-versions=[20, 22, 24]" >> $GITHUB_OUTPUT
37+
else
38+
echo "node-versions=[${{ github.event.inputs.node-version }}]" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Generate test suite matrix
42+
id: set-matrix
43+
run: |
44+
# Get application management test directories
45+
app_dirs=$(ls -d integrationTests/applicationManagement/tests/*/ 2>/dev/null | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]' || echo '[]')
46+
47+
# Create test suite array with apiTests and all app management dirs
48+
test_suites=$(echo '["apiTests"]' | jq --argjson app_dirs "$app_dirs" '. + $app_dirs')
49+
50+
echo "test-suites=${test_suites}" >> $GITHUB_OUTPUT
51+
52+
build:
53+
name: Build (Node.js v${{ matrix.node-version }})
54+
needs: generate-matrix
55+
runs-on: ubuntu-latest
56+
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
node-version: ${{ fromJSON(needs.generate-matrix.outputs.node-versions) }}
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v5
65+
66+
- name: Setup Node.js ${{ matrix.node-version }}
67+
uses: actions/setup-node@v6
68+
with:
69+
node-version: ${{ matrix.node-version }}
70+
package-manager-cache: false
71+
72+
- name: Install dependencies
73+
run: npm install
74+
75+
- name: Build
76+
run: npm run build || true # we currently have type errors so just ignore that
77+
78+
- name: Upload build artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: harper-build-artifacts-node-${{ matrix.node-version }}
82+
path: |
83+
dist/
84+
static/
85+
node_modules/
86+
package.json
87+
retention-days: 1
88+
89+
test:
90+
name: Test ${{ matrix.test-suite }} (Node.js v${{ matrix.node-version }})
91+
needs: [generate-matrix, build]
92+
runs-on: ubuntu-latest
93+
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
node-version: ${{ fromJSON(needs.generate-matrix.outputs.node-versions) }}
98+
test-suite: ${{ fromJSON(needs.generate-matrix.outputs.test-suites) }}
99+
100+
steps:
101+
- name: Checkout code
102+
uses: actions/checkout@v5
103+
104+
- name: Setup Node.js ${{ matrix.node-version }}
105+
uses: actions/setup-node@v6
106+
with:
107+
node-version: ${{ matrix.node-version }}
108+
package-manager-cache: false
109+
110+
- name: Download build artifacts
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: harper-build-artifacts-node-${{ matrix.node-version }}
114+
115+
- name: Setup Harper
116+
env:
117+
DEFAULTS_MODE: 'dev'
118+
HDB_ADMIN_USERNAME: 'admin'
119+
HDB_ADMIN_PASSWORD: 'password'
120+
ROOTPATH: '/tmp/hdb'
121+
OPERATIONSAPI_NETWORK_PORT: 9925
122+
LOGGING_LEVEL: 'debug'
123+
LOGGING_STDSTREAMS: true
124+
THREADS_COUNT: 1
125+
THREADS_DEBUG: false
126+
NODE_HOSTNAME: 'localhost'
127+
run: |
128+
node --enable-source-maps ./dist/bin/harperdb.js install
129+
sleep 10
130+
node --enable-source-maps ./dist/bin/harperdb.js start
131+
sleep 10
132+
133+
- name: Run apiTests
134+
if: matrix.test-suite == 'apiTests'
135+
env:
136+
HDB_ADMIN_USERNAME: 'admin'
137+
HDB_ADMIN_PASSWORD: 'password'
138+
run: npm run test:integration:api-tests
139+
140+
- name: Run application management tests for ${{ matrix.test-suite }}
141+
if: matrix.test-suite != 'apiTests'
142+
run: |
143+
node --test integrationTests/applicationManagement/tests/${{ matrix.test-suite }}/*.test.mts
144+
145+
- name: Upload HarperDB logs
146+
if: always()
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: harper-logs-node-${{ matrix.node-version }}-${{ matrix.test-suite }}
150+
path: /tmp/hdb/log/hdb.log
151+
retention-days: 7

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"lint": "eslint .",
3636
"format:check": "prettier --check .",
3737
"format:write": "prettier --write .",
38-
"test:integration:apiTests": "node --test integrationTests/apiTests/tests/testSuite.mjs",
38+
"test:integration:api-tests": "node --test integrationTests/apiTests/tests/testSuite.mjs",
3939
"test:integration:application-management": "node --test --test-concurrency=1 \"integrationTests/applicationManagement/tests/**/*.test.mts\"",
4040
"test:unit": "TSX_TSCONFIG_PATH=./unitTests/tsconfig.json npx mocha --config unitTests/.mocharc.json",
4141
"test:unit:all": "npm run test:unit unitTests"

0 commit comments

Comments
 (0)