Skip to content

Smoke Tests

Smoke Tests #889

Workflow file for this run

name: Smoke Tests
# Nightly canaries: deploy each customer-facing component onto an in-process Harper cluster built
# from this repo's dist/, seed data, and run a short low-load k6/JMeter check. Scheduled nightly to
# keep CI costs down; also runnable on demand. See smokeTests/README.md.
on:
push: # required-check gate: skip job passes immediately; smoke job if: guards against push runs
schedule:
# Nightly at 06:00 UTC. Offset from Sync Core (07:00) so they don't contend.
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
component:
description: 'Which component(s) to smoke test'
type: choice
default: 'all'
options:
- all
- risk-query
- redirector
node-version:
description: 'Node.js version'
type: string
default: '24'
permissions:
contents: read
concurrency:
group: smoke-tests-${{ github.ref }}
cancel-in-progress: false
jobs:
# On push events (required-check context) the smoke tests should not run.
# This job passes immediately, satisfying the required-check gate.
skip:
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- run: echo "Smoke tests run on schedule/dispatch only — skipping."
smoke:
name: Smoke ${{ matrix.component }}
runs-on: ubuntu-latest
timeout-minutes: 30
# matrix.component is not available at job-level if:, so filter per-component at the step level.
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
# Keep refs in sync with smokeTests/manifest.mjs.
include:
- component: risk-query
repo: HarperFast/risk-query
ref: main
dir: risk-query
- component: redirector
repo: HarperFast/template-redirector
ref: main
dir: template-redirector
env:
NODE_VERSION: ${{ github.event.inputs.node-version || '24' }}
HARPER_INTEGRATION_TEST_LOG_DIR: /tmp/harper-smoke-test-logs
steps:
# App token so we can check out the (org-private) component repos.
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.HARPERFAST_AI_CLIENT_ID }}
private-key: ${{ secrets.HARPERFAST_AI_APP_PRIVATE_KEY }}
- name: Checkout harper-pro
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}
- name: Checkout component (${{ matrix.repo }}@${{ matrix.ref }})
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ matrix.repo }}
ref: ${{ matrix.ref }}
token: ${{ steps.app-token.outputs.token }}
path: smokeTests/.components/${{ matrix.dir }}
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
package-manager-cache: false
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build || true # known type errors are ignored here, same as integration-tests
- name: Install k6
run: |
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg \
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" \
| sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install -y k6
- name: Run smoke canary (${{ matrix.component }})
if: github.event_name == 'schedule' || github.event.inputs.component == 'all' || github.event.inputs.component == matrix.component
run: node smokeTests/run-smoke.mjs --component=${{ matrix.component }}
- name: Upload Harper server logs
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: harper-smoke-logs-${{ matrix.component }}
path: ${{ env.HARPER_INTEGRATION_TEST_LOG_DIR }}/
retention-days: 5
if-no-files-found: ignore