Files
openwaf/.github/workflows/ci.yml
T
Pavlo Ratushnyi bf1129a8d8 The failure mode on a write form is the one nobody demos
The console now writes, so the question stopped being "does the table show the
ban" and became "what happens when the operator types the wrong thing". A form
that accepts `not-an-ip`, says nothing, and adds no row leaves an operator
believing an address is blocked when it is not — which is worse than giving them
no console at all.

Two assertions added to the browser gate. The API already rejected the value
(`BlockStore.AddOperatorAsync` returns `not an IP address: not-an-ip`, the
endpoint answers 400, the page already surfaces `body.error` in its status line);
what is new is that a gate now proves that chain instead of assuming it. The run
prints the actual string: `not an IP address: not-an-ip`, and no phantom row in
the bans table. Console gate: **26/26**.

Also measured, because a timeout written at a desk is a guess: the Linux
rehearsal (`scripts/ci-linux-rehearsal.sh`, added in `42d4af9`) was re-run with
`time`. Cold container, cold NuGet cache, Ubuntu 24.04.5, SDK 10.0.401:
**1:02.81** wall for restore + build + unit + integration + smoke. The source
job's `timeout-minutes: 25` is not close, even allowing for a runner's slower
CPU. Before this, the number in the workflow was folklore from a build that once
stalled ~12 minutes on a single apt-get step.

No source-tree change in this commit: gate assertions and the numbers written
down where the next reader will look for them. Unchanged and still said plainly:
no job of this workflow has executed on a runner — the repository has no remote.
2026-10-01 15:16:19 +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 source-tree gates (restore, build, unit,
# integration, smoke) inside 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 on
# 2026-10-01, first try, 1:02.81 wall with a cold container and a cold NuGet
# cache — evidence that the 25-minute timeout below is not near. The image and compose
# gates already run a Linux image;
# 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