Files
openwaf/.github/workflows/ci.yml
T
Pavlo Ratushnyi bb9ac0d927 132 compose assertions now, and the numbers describe the tree that has them
Re-measured at 9383362 rather than carried forward from 5c44b7c:

  host ci-gates.sh all      unit 132/132, integration 173/173, smoke 28/0,
                            image 261 MB, compose 132/0
  host console              70 ok, 0 failed
  Linux rehearsal           source PASS, compose 132/0 at 15 ms,
                            console PASS 70/0 on the second run
  act                       5 jobs succeeded, 0 failed; compose smoke 132/0;
                            console 70; console-evidence.zip 682,072 bytes

The Linux console stage failed once at this head — the markup-path row was not in
the observation table when the driver looked, and the driver looks once. That is
filed as OPEN-41 with both logs named; the stage was re-run and passed, and the
pass is quoted together with the failure, not instead of it.
2026-10-02 20:59:48 +02:00

236 lines
11 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: it has never executed on a GitHub-hosted
# runner, because the repository has no remote yet. It has executed start to
# finish in a local Actions-compatible runner (nektos/act 0.2.89, image
# catthehacker/ubuntu:act-latest): all four jobs below reported success, and so
# did the freshness job in geo-freshness.yml — five jobs on a push in total,
# four here plus one there. That run proves the YAML plays and the pinned tools
# resolve — and it is how the lint
# job's shellcheck version drift was found (ubuntu-latest ships 0.9.0-1, the
# pinned step now runs 0.11.0 with a checksum). Do not read this file as proof
# that CI on GitHub is green: it is proof of what CI will run, executed once by
# something other than an agent who chose the steps. What narrowed the gap
# further 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: unit 132/132,
# integration 173/173, smoke 28/28, first try (at 9383362). Compose gate in docker:cli against
# the host daemon: 132/132 on Linux. Console gate in
# mcr.microsoft.com/playwright:v1.63.0-noble - the stack seeded by docker:cli,
# the same console-check.cjs driving it in a real Linux Chromium: 70/70. The
# only wall clock ever measured for the source job is 1:02.81 cold (first
# rehearsal); later rehearsals were not re-timed, so that number is quoted as
# measured once, not as current. So every gate this file runs has a Linux
# number. What it does not have is a runner: the repository has no remote, so
# this file has never executed on GitHub. It has been executed by a local
# Actions-compatible runner (nektos/act 0.2.89, catthehacker/ubuntu:act-latest)
# at 9383362: 5 jobs succeeded, 0 failed - lint, source (132/132, 173/173, smoke
# 28/0), image (261 MB, compose smoke 132/0), console (70 assertions, screenshot
# artifact, 682,072-byte zip) and freshness (pin 2026-10 = newest 2026-10).
name: ci
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
# Two pushes in a row should not queue two full gate runs behind each other.
# cancel-in-progress is deliberately false: a run that finishes is the evidence
# a merge decision gets read later, and cancelling the run that is already
# executing throws that away to save nothing. GitHub keeps the newest pending
# run and drops the ones still waiting behind it, which is the part worth
# dropping.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
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
# Both files, by glob: a workflow added later is linted by the same
# step without anyone remembering to add it to a list.
/tmp/actionlint -no-color .github/workflows/*.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.
#
# The version is pinned the same way actionlint is, because relying on the
# copy baked into the image made the gate's verdict depend on the image:
# ubuntu-latest ships shellcheck 0.9.0-1, and running this file in a local
# actions-compatible runner (nektos/act on catthehacker/ubuntu:act-latest)
# had 0.9.0 flag an `A && B || C` pattern in scripts/geo-db-bump.sh that
# the 0.11.0 developers run locally does not. The script was rewritten as
# an explicit if, and the version is fixed here so the gate says the same
# thing everywhere it runs. The log prints which version did the linting.
- name: shellcheck the smoke scripts (pinned, checksum verified)
run: |
VERSION=0.11.0
SHA_X86_64=8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198
SHA_AARCH64=12b331c1d2db6b9eb13cfca64306b1b157a86eb69db83023e261eaa7e7c14588
case "$(uname -m)" in
x86_64) ARCH=x86_64; SHA=$SHA_X86_64 ;;
aarch64) ARCH=aarch64; SHA=$SHA_AARCH64 ;;
*) echo "shellcheck: unsupported architecture $(uname -m)" >&2; exit 1 ;;
esac
curl -fsSL -o /tmp/shellcheck.tar.xz \
"https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.linux.${ARCH}.tar.xz"
echo "${SHA} /tmp/shellcheck.tar.xz" | sha256sum -c -
tar xJf /tmp/shellcheck.tar.xz -C /tmp
/tmp/shellcheck-v${VERSION}/shellcheck --version
/tmp/shellcheck-v${VERSION}/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
env:
# Its own compose project and its own host port. The console job below
# brings up the same file, and on any machine where two jobs share one
# docker daemon (a self-hosted runner, a local act run) the default
# project name and the default 8080 make them the same stack: one
# job's `compose down` is the other's connection refused. Measured, not
# guessed — see the comment in docker-compose.yml.
COMPOSE_PROJECT_NAME: openwafci-image
EDGE_PORT: "8080"
EDGE: http://127.0.0.1:8080
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 GitHub-hosted runner. It has run
# in a local Actions-compatible runner (act, catthehacker/ubuntu:act-latest):
# the pinned playwright@1.63.0 installed, chromium-1243 downloaded, the gate
# reported 33 assertions / 0 failed, and the screenshot step published the
# artifact (console-evidence.png 335998 bytes, console-evidence.phone.png
# 264597 bytes). Locally the same gate passes with playwright-core 1.62.1 when
# that is the browser the machine already holds — the version the log names is
# the version that ran. Its control (a missing playwright-core) exits 2, and 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
# See the compose-smoke step: a separate project and port, so the two
# jobs cannot tear down each other's stack.
COMPOSE_PROJECT_NAME: openwafci-console
EDGE_PORT: "8090"
EDGE: http://127.0.0.1:8090
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