Files
openwaf/.github/workflows/ci.yml
T
Pavlo Ratushnyi c290aa06f6 Every gate this workflow runs now has a Linux number except one
`scripts/ci-linux-rehearsal.sh` (added in `42d4af9`) covered the dotnet suites
and `smoke.sh`. The third thing the objective asks CI to run — `scripts/
compose-smoke.sh` — did not have a Linux number, and "we run it on macOS against
a Linux image" is only half a proof: the script itself is the part that could be
a darwin habit.

It now runs in `docker:cli` against the host daemon, so the image build, the
stack and the asserting shell are all Linux. Full rehearsal, one invocation:

    source gates (restore/build/unit/integration/smoke): PASS   54/54, 28/28, 19/19
    compose gate: PASS                                          27 passed, 0 failed
    console gate: not covered here (needs a real Chromium)
    wall: 47.61 s

Getting it green surfaced two facts about the harness, not the product, and both
are now comments in the script where the next person will hit them:

- `compose-smoke.sh` asserts over JSON with **python3** (`jcount`/`jget`) and
  reads the clock with it. A bare container failed **23 of 27** assertions for
  nothing else. The runner image has python3; `docker:cli` does not, so the
  stage installs bash, curl and python3 itself.
- The stack is created by the host daemon, so its published port lives in the
  host's network namespace. Without `EDGE=http://host.docker.internal:8080`,
  every HTTP assertion returns curl code `000` **while the image's own
  HEALTHCHECK reports healthy** — a green stack with red assertions, the most
  confusing failure this gate can produce. The gate already had an `EDGE`
  override; this is what it is for.

The compose stage also printed its own instrumentation again: enforcement lag
**12 ms** between writing a ban and the edge refusing the source — the snapshot
invalidation path, measured on Linux this time.

Still true and still said plainly: none of these jobs has executed on a runner,
because the repository has no remote. The Linux numbers narrow what a first run
could still discover; they do not replace one.
2026-10-01 15:31:16 +02:00

165 lines
6.7 KiB
YAML

# The gates OPEN-2's evidence rests on, run by something other than an agent who
# chose to run them. Four mergeEvidence fields on that epic say "no CI pipeline
# exists yet — every gate quoted above was run locally"; this closes that.
#
# Honest status of this file itself: the workflow has never executed on a
# runner, because the repository has no remote yet. Do not read this file as
# proof that CI is green — it is proof of what CI will run. What narrowed the
# gap between those two sentences is that the steps below no longer retype the
# commands: they call scripts/ci-gates.sh, the same file an operator runs as
# `scripts/ci-gates.sh all` before pushing. One definition of a gate, two
# callers, so a local green run and a CI green run cannot drift apart.
#
# Timeouts are explicit. The first build of this project stalled ~12 minutes on
# a single apt-get step; a hung job is worse than a failed one.
#
# What has been done to narrow the darwin/linux gap without a runner:
# scripts/ci-linux-rehearsal.sh runs the gates in containers. Source gates
# (restore, build, unit, integration, smoke) in mcr.microsoft.com/dotnet/sdk:10.0
# — Ubuntu 24.04.5, SDK 10.0.401 resolving the pinned global.json, 54/54 + 28/28
# + 19/19, first try, 1:02.81 wall cold: evidence that the 25-minute timeout
# below is not near. Compose gate in docker:cli against the host daemon: 27/27 on
# Linux. So every gate this file runs except the console one now has a Linux
# number; the console gate needs a Chromium and stays macOS-verified until this
# file actually executes.
name: ci
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
DOTNET_NOLOGO: "1"
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
# The compose smoke test needs a token to exercise the admin API. It is not a
# secret: it is a throwaway value for a stack that exists only inside the job.
OPENWAF_ADMIN_TOKEN: ci-only-throwaway
jobs:
lint:
name: lint the workflow and the shell
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
# The linter itself is pinned to a version and a checksum, not piped from
# a setup script: a gate that can be moved by someone republishing a tag is
# not a gate. actionlint also checks the run: blocks below with shellcheck.
- name: actionlint (pinned, checksum verified)
run: |
VERSION=1.7.12
SHA256=8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8
curl -fsSL -o /tmp/actionlint.tar.gz \
"https://github.com/rhysd/actionlint/releases/download/v${VERSION}/actionlint_${VERSION}_linux_amd64.tar.gz"
echo "${SHA256} /tmp/actionlint.tar.gz" | sha256sum -c -
tar xzf /tmp/actionlint.tar.gz -C /tmp actionlint
/tmp/actionlint -no-color .github/workflows/ci.yml
# Both smoke scripts are gates, so a broken one has to fail loudly here
# rather than look like a passing run with zero assertions.
- name: shellcheck the smoke scripts
run: shellcheck -s bash scripts/*.sh
source:
name: build, test, smoke
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: Install the SDK pinned by dotnet/global.json
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
10.0.x
# One gate per step so the job log still names the one that failed; the
# definitions live in scripts/ci-gates.sh, not here.
- name: Restore
run: ./scripts/ci-gates.sh restore
- name: Build (also the warning gate — TreatWarningsAsErrors)
run: ./scripts/ci-gates.sh build
- name: Unit tests — the decision core
run: ./scripts/ci-gates.sh unit
- name: Integration tests — the real pipeline against a fake upstream
run: ./scripts/ci-gates.sh integration
- name: Smoke — a running edge and a real upstream, curl assertions
run: ./scripts/ci-gates.sh smoke
image:
name: build the image and smoke it
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# The plain build, the one the README shows, plus its size: this is the
# step that catches a Dockerfile regression the compose path would hide.
- name: docker build and image size
run: ./scripts/ci-gates.sh image
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts
# over a socket, and tears the stack down on exit.
- name: Compose smoke — the deployed image
run: ./scripts/ci-gates.sh compose-smoke
# The console is a page, and a page fails in ways curl cannot see: a typo in
# the inline script, a fetch that 401s, a table that renders nothing while the
# summary looks fine. This drives it in a real Chromium.
#
# Honest status: this job has never run on a runner, like the rest of the
# file. What was verified is the gate it calls — scripts/ci-gates.sh console
# passed locally (26 assertions, playwright-core 1.61.1), and its negative
# control (a wrong token) exits 1 rather than reporting success. The step
# calls the gate by name rather than retyping the script, so the CI definition
# and the operator command cannot drift.
console:
name: the operator page in a real browser
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
# Pinned to a version that exists in the registry at the time of writing
# (checked with `npm view playwright version`), and the browser is
# installed for that exact version.
- name: Install playwright (pinned) and chromium
run: |
npm init -y >/dev/null
npm install --no-save playwright@1.63.0
npx playwright install --with-deps chromium
echo "PLAYWRIGHT_CORE=$(node -e 'console.log(require.resolve("playwright-core"))')" >> "$GITHUB_ENV"
- name: Console smoke — the page, not only its endpoints
env:
# Written into the job's workspace so the next step can publish it.
# A green console job with no picture leaves nothing to inspect once
# the runner is gone; a red one leaves the reviewer the page as it
# broke. console-check.cjs writes <path> and <path>.phone.png.
SCREENSHOT: console-evidence.png
run: ./scripts/ci-gates.sh console
# always(): the failure case is the one worth looking at.
- name: Publish the console screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: console-evidence
path: console-evidence*.png
if-no-files-found: warn
retention-days: 14