-
Notifications
You must be signed in to change notification settings - Fork 0
Add integration-tests CI and fix harness CLI resolution #5
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,75 @@ | ||||||||
| 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 | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: unneeded checkout in This job only derives the Suggested fix: drop this step (and the — |
||||||||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||||||||
|
|
||||||||
| - 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=[22, 24, 26]" >> $GITHUB_OUTPUT | ||||||||
| else | ||||||||
| echo "node-versions=[${{ github.event.inputs.node-version }}]" >> $GITHUB_OUTPUT | ||||||||
| fi | ||||||||
|
|
||||||||
| integration-tests: | ||||||||
| name: Integration Tests (Node ${{ matrix.node-version }}) | ||||||||
| needs: [generate-node-version-matrix] | ||||||||
| runs-on: ubuntu-latest | ||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing job-level timeout — the Suggest adding integration-tests:
name: Integration Tests (Node ${{ matrix.node-version }})
needs: [generate-node-version-matrix]
runs-on: ubuntu-latest
timeout-minutes: 15 |
||||||||
| timeout-minutes: 15 | ||||||||
|
|
||||||||
| 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 | ||||||||
|
|
||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No npm cache configured — the - name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm' |
||||||||
| - name: Set up Node.js | ||||||||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||||||||
| with: | ||||||||
| node-version: ${{ matrix.node-version }} | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Low: no npm cache configured All three matrix legs (Node 22/24/26) run a full Suggested fix:
Suggested change
— |
||||||||
|
|
||||||||
| - 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 | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import { suite, test, before, after } from 'node:test'; | |
| import { strictEqual, ok } from 'node:assert/strict'; | ||
| import { setupHarperWithFixture, teardownHarper, type ContextWithHarper } from '@harperfast/integration-testing'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { dirname, resolve } from 'node:path'; | ||
|
|
||
| const FIXTURE_PATH = fileURLToPath(new URL('../', import.meta.url)); | ||
|
|
||
|
|
@@ -26,7 +27,11 @@ function authFetch( | |
|
|
||
| void suite('agent-example-harper loads', (ctx: ContextWithHarper) => { | ||
| before(async () => { | ||
| await setupHarperWithFixture(ctx, FIXTURE_PATH, { startupTimeoutMs: 60000 }); | ||
| // harper's exports map only exposes ".", so resolving 'harper/dist/bin/harper.js' | ||
| // (the harness's default auto-resolution) throws ERR_PACKAGE_PATH_NOT_EXPORTED. Resolve the CLI | ||
| // from harper's exported main entry and pass it explicitly via the harness escape hatch. | ||
| const harperBinPath = resolve(dirname(fileURLToPath(import.meta.resolve('harper'))), 'bin/harper.js'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Low:
Suggested fix: no code change needed now, but consider a one-line comment linking to the upstream tracking issue (mentioned in the PR description — harper should export its bin path) so future readers know this is a deliberate, tracked workaround rather than an oversight. — |
||
| await setupHarperWithFixture(ctx, FIXTURE_PATH, { startupTimeoutMs: 60000, harperBinPath }); | ||
| }); | ||
|
|
||
| after(async () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low: no explicit
permissionsblockThe workflow doesn't declare
permissions:, so theGITHUB_TOKENinherits whatever the repo/org default grants (which can be read-write). This workflow only checks out code and runs tests — it never comments on PRs or pushes — so it needs nothing beyond read access.Suggested fix: add near the top of the file:
—
Generated by Barber AI