Skip to content
Merged
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
75 changes: 0 additions & 75 deletions .github/workflows/integration-test.yml

This file was deleted.

164 changes: 164 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Integration Tests

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
node-version:
description: 'Node.js version'
required: true
type: choice
default: 'all'
options:
- 'all'
- '20'
- '22'
- '24'

jobs:
generate-node-version-matrix:
name: Generate Node Version Matrix
runs-on: ubuntu-latest
outputs:
node-versions: ${{ steps.set-node-versions.outputs.node-versions }}

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set Node versions
id: set-node-versions
run: |
if [ "${{ github.event.inputs.node-version }}" == "all" ] || [ -z "${{ github.event.inputs.node-version }}" ]; then
echo "node-versions=[20, 22, 24]" >> $GITHUB_OUTPUT
else
echo "node-versions=[${{ github.event.inputs.node-version }}]" >> $GITHUB_OUTPUT
fi

build:
name: Build Harper (Node.js v${{ matrix.node-version }})
needs: generate-node-version-matrix
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }}

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
package-manager-cache: false

- name: Install dependencies
run: npm install

- name: Build
run: npm run build || true # we currently have type errors so just ignore that

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: harper-build-artifacts-node-${{ matrix.node-version }}
path: |
dist/
static/
node_modules/
package.json
retention-days: 1

run-integration-apiTests:
name: Integration API Tests (Node.js v${{ matrix.node-version }})
needs: [generate-node-version-matrix, build]
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }}

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
package-manager-cache: false

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: harper-build-artifacts-node-${{ matrix.node-version }}

- name: Setup Harper
env:
DEFAULTS_MODE: 'dev'
HDB_ADMIN_USERNAME: 'admin'
HDB_ADMIN_PASSWORD: 'password'
ROOTPATH: '/tmp/hdb'
OPERATIONSAPI_NETWORK_PORT: 9925
LOGGING_LEVEL: 'debug'
LOGGING_STDSTREAMS: true
THREADS_COUNT: 1
THREADS_DEBUG: false
NODE_HOSTNAME: 'localhost'
run: |
node ./dist/bin/harper.js install
sleep 10
node ./dist/bin/harper.js start
sleep 10

- name: Run API Tests
id: run-api-tests
env:
HDB_ADMIN_USERNAME: 'admin'
HDB_ADMIN_PASSWORD: 'password'
run: npm run test:integration:api-tests

- name: Upload Harper logs
if: steps.run-api-tests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: harper-integration-api-test-logs-node-${{ matrix.node-version }}
path: /tmp/hdb/log/hdb.log
retention-days: 2

run-integration-tests:
name: Integration Tests ${{matrix.shard}}/4 (Node.js v${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: [generate-node-version-matrix, build]
strategy:
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }}
shard: [1, 2, 3, 4]
exclude:
- node-version: 20

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
package-manager-cache: false

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: harper-build-artifacts-node-${{ matrix.node-version }}

- name: Run Integration Test Shard ${{ matrix.shard }}
run: |
npm run test:integration -- --shard=${{ matrix.shard }}/4
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Install dependencies using `npm install`

Build the project using `npm run build` or `npm run build:watch` to automatically rebuild on file changes.

Run integration tests using `npm run test:integration`. Make sure to read the [integration test instructions](./integrationTests/apiTests/README.md) for setup.
Run integration tests using `npm run test:integration`. Make sure to read the [integration test instructions](./integrationTests/README.md) for setup requirements (particularly the loopback address configuration).

Run unit tests using `npm run test:unit <unit-test-file>` or `npm run test:unit:all`, but make sure to build the project first since unit tests depend on the built source files.

Expand Down
10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ export default defineConfig([
rules: {},
},

{
files: ['**/*.test.{ts,mts}'],
rules: {
// Allow floating promises in test files for async test functions
'@typescript-eslint/no-floating-promises': {
allowForKnownSafePromises: [{ from: 'node:test', names: ['describe', 'it', 'suite', 'test'] }],
},
},
},

// Disable conflicting ESLint formatting rules
// Prettier formatting is only enforced via `npm run format:check` and editor integrations
// More information here: https://prettier.io/docs/integrating-with-linters.html
Expand Down
Loading
Loading