Skip to content
Open
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
76 changes: 76 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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'
- '22'
- '24'
- '26'

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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup: $GITHUB_OUTPUT should be double-quoted

The shell step writes to $GITHUB_OUTPUT unquoted. If the env var somehow contains spaces (unlikely in practice but non-standard), the word-splitting would silently produce the wrong redirect target. Best practice in CI shell steps is to quote all variable references.

Suggested change
echo "node-versions=[22, 24, 26]" >> $GITHUB_OUTPUT
echo "node-versions=[22, 24, 26]" >> "$GITHUB_OUTPUT"

else
echo "node-versions=[$NODE_VER]" >> $GITHUB_OUTPUT
fi

integration-tests:
name: Integration Tests (Node ${{ 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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Run integration tests
run: npm run test:integration
env:
HARPER_INTEGRATION_TEST_LOG_DIR: /tmp/harper-test-logs
FORCE_COLOR: '1'

- name: Upload Harper logs on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: harper-logs-node-${{ matrix.node-version }}
path: /tmp/harper-test-logs/
retention-days: 7
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules/
package-lock.json
node_modules/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# @harperdb/http-router

A [HarperDB Component](https://docs.harperdb.io/docs/developers/components) for routing requests to other components that is inspired by the Edgio router API: https://docs.edg.io/applications/v4/routing.
A [Harper Component](https://docs.harperdb.io/docs/developers/components) for routing requests to other components that is inspired by the Edgio router API: https://docs.edg.io/applications/v4/routing.

![NPM Version](https://img.shields.io/npm/v/%40harperdb%2Fhttp-router)

## Installation
Go into the HarperDB application you would building and install this package and add it to the `config.yaml` file:
Go into the Harper application you would building and install this package and add it to the `config.yaml` file:

1. Install:

Expand Down
3 changes: 3 additions & 0 deletions integrationTests/fixture/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Un-ignore node_modules for this fixture — CI (npm ci at repo root) does not
# install fixture deps, so the fixture's node_modules must be committed.
!node_modules/
3 changes: 3 additions & 0 deletions integrationTests/fixture/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'@harperdb/http-router':
package: '@harperdb/http-router'
files: '*.js'
217 changes: 217 additions & 0 deletions integrationTests/fixture/node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading