Files
invoiceninja-sdk/.github/workflows/smoke.yml
T
awkawbandClaude Opus 5 a7d9a2d9d6 Extend the smoke test with write and password tiers
The read tier now also fetches each row raw and fails if a typed row lost a
key, which is what catches a field the models drop.

The write tier creates a purchase order, location, webhook and recurring
invoice from bare `Default` models, since those are exactly what broke
against a real server, and exercises the uploads and the client extras. The
password tier merges two throwaway clients and purges the survivor.

Writes stay behind the existing guard: `IN_SMOKE_WRITE_HOST` must equal the
host in `IN_BASE_URL`, so a write only ever reaches a server that was named
explicitly. It prints PASS/FAIL per check and never the contents of a
record. `smoke.yml` runs it on demand only (`workflow_dispatch`), with the
write tier gated on the `write_host` input naming the instance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-24 21:56:31 -04:00

48 lines
1.8 KiB
YAML

name: Smoke test
# Runs `examples/smoke_test.rs` against a real Invoice Ninja instance. Manual
# only: it needs an instance the runner can reach and credentials for it, and
# the offline suite in `ci.yml` is what gates merges. This is for catching the
# places where the real server disagrees with the upstream source the mocks
# were written from.
#
# Repository secrets required: IN_BASE_URL (the API root, ending /api/v1) and
# IN_API_TOKEN. Point them at a disposable instance, never at production.
on:
workflow_dispatch:
inputs:
write_host:
description: >-
Leave empty for the read-only tier (GET requests only). To also run
the write tier, type the host of IN_BASE_URL (e.g. `localhost`). It
creates and deletes records, so the instance must be disposable.
required: false
default: ''
type: string
runner:
description: Runner label; use a self-hosted one if the instance is not public.
required: false
default: ubuntu-latest
type: string
permissions:
contents: read
jobs:
smoke:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v4
# Same pin as `ci.yml` and `devVersion` in flake.nix.
- uses: dtolnay/rust-toolchain@1.99.1
- run: cargo run --example smoke_test
env:
IN_BASE_URL: ${{ secrets.IN_BASE_URL }}
IN_API_TOKEN: ${{ secrets.IN_API_TOKEN }}
# The program refuses to write unless this equals the host in
# IN_BASE_URL, so a mistyped host skips the write tier.
IN_SMOKE_WRITE_HOST: ${{ inputs.write_host }}
# Optional. Only used inside the write tier, where it enables the
# password tier (merge two throwaway clients, purge the survivor).
IN_API_PASSWORD: ${{ secrets.IN_API_PASSWORD }}