Repository navigation
feat: extract acceptance-test-driven CI from saiku as reusable workflows - #1
Merged
Merged
Conversation
Repository-agnostic scripts (ACCEPTANCE_* env), reusable workflows convention.yml, run-specs.yml and base-check.yml that load their scripts at the caller's pinned ref via job.workflow_repository / job.workflow_sha, docs, a loopback fixture, unit and end-to-end tests, and a self-test workflow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extracts saiku's acceptance-test-driven CI (spiculedata/saiku
development, incl. #2239) into reusable code:scripts/: repo-agnosticacceptance-spec/-runner/-check/-base-check.mjsplusstart-server.sh/stop-server.sh, with their unit tests (plain Node 22+, no dependencies, nopackage.json).on: workflow_call):convention.yml,run-specs.yml,base-check.yml(red on base / green on head,spec-already-greenhatch, base build cached on the base SHA).README.md,docs/spec-format.md,docs/adopting.md.ci.yml(unit tests on node 22 and 24, aggregate jobci),selftest.yml(calls the three workflows onfixtures/consumer, a loopback server).Callers pin
spiculedata/acceptance-spec/.github/workflows/<name>.yml@<full-sha>.How the scripts are loaded at the pinned ref
Each job checks out this repo with
repository: ${{ job.workflow_repository }}andref: ${{ job.workflow_sha }}(sparse,scripts/only). Per GitHub's contexts docs thesejob.*properties describe the workflow file that defines the current job, i.e. the called workflow, unlike thegithubcontext (the caller). Norefinput and noid-token: write(whichjob_workflow_shawould need). Each job refuses an empty or non-40-hex value, verifies the checked-outHEADequals it, then movesscripts/to$RUNNER_TEMP.Why
Private repos (inertia, kinetic, keel, later hoaapp; saiku/saiku-cloud eventually) should reuse this with a pinned SHA and a thin caller instead of copying scripts.
Deviations from saiku (all intentional)
SAIKU_ACCEPTANCE_USER/PASSWORD->ACCEPTANCE_USER/PASSWORD;SAIKU_BASE_URLis no longer exported (onlyACCEPTANCE_BASE_URL). Allow-list nowACCEPTANCE_*only./rest/saiku/*: base path frombase-path/ACCEPTANCE_BASE_PATH(default none), form-login path fromsession-path/ACCEPTANCE_SESSION_PATH;auth: sessionwithout it isnot-run. The/rest/as-is rule is kept.kind: "command"added;uikept as an alias.--feedback,attach,summariseResults,attachResults) is not extracted: saiku's schema is not generic. The results JSON is uploaded as an artifact.saiku-ui/e2e/generalised to(^|/)e2e/;tests/totests?/.ACCEPTANCE_ENFORCE_FROM_ISSUErepo variable becomes theenforce-from-issueinput.base-check.ymlis self-contained: it builds and runs both head and base itself (only the changed specs) instead of downloading thespecsjob's artifact, so it does not depend on another workflow in the caller. Cost: one extra head build on PRs that touch a spec.ACCEPTANCE_USER,ACCEPTANCE_PASSWORD,BUILD_TOKEN) because reusable workflows cannot take dynamic secret names.skip-without-build-tokenreproduces saiku's fork-PR behaviour (no build, api specsnot-run).mode: report|enforceadded (all three workflows): failures become warnings.not-run.Unchanged:
pull_requestonly (enforced by a runtime guard and a test),contents: read, no write scope, noGITHUB_TOKENto specs, allow-listed spec env, api specs limited to the base URL's origin, no redirects followed, a spec that cannot run is neverpass.Verification
node --test "scripts/*.test.mjs": 99 tests, all pass locally (node 24). Includes the real start/stop scripts + runner + base check on the loopback fixture, workflow guard tests (SHA pins, nopull_request_target/workflow_run/write scopes, secrets list, no${{ }}inrun:, scripts loaded viajob.workflow_*) and a hygiene scan (no tokens, hostnames, IPs, host paths).ci, unit tests node 22 and 24,selftestwith convention / run-specs / base-check jobs). In the self-test logsjob.workflow_repository/job.workflow_sharesolved to this repo and the merge commit (local./call).run-specspassed both fixture specs against the loopback server.base-checkreportednot-runfor the api spec andpass(red on base) for the command spec, as designed for a base commit that does not yet contain the fixture.Risk
Low for this repo (new code only). The reusable workflows are untested from another repository until merged.
Not verified, check after merge
uses: spiculedata/acceptance-spec/.github/workflows/<name>.yml@<sha>from a private caller: thatjob.workflow_repository/job.workflow_sharesolve to this repo at the pinned SHA there (the job fails with an explicit error if not), and that the private caller's default token can fetch this public repo.selftest.ymlonly exercises the local./form.base-checkon a real build: here it runs only on the PR that adds the fixture spec (later PRs touch no spec, so it is skipped), and base-side behaviour is covered by the local end-to-end test, not a CI run with a real base build and cache restore/save.🤖 Generated with Claude Code