Files
openwaf/.github/workflows/ci.yml
T
Pavlo Ratushnyi 9491f01b86 CI: lint the workflow and the shell that runs the gates
A gate that is only checked by eye is a gate that fails silently. Two additions
to ci.yml:

 * a lint job running actionlint 1.7.12 pinned by a checksum-verified tarball —
   not piped from a setup script, because a gate someone can move by
   republishing a tag is not a gate. actionlint also shellchecks the run: blocks
   it reads, including its own.
 * shellcheck over scripts/*.sh. Both smoke scripts are gates, so a broken one
   has to fail loudly rather than report a green run with zero assertions.

shellcheck found four real things in compose-smoke.sh: an unguarded cd, and
unquoted source IPs in the X-Forwarded-For helpers. Fixed; the script now passes
shellcheck and still reports 27/27 against the built image.

Verified, not assumed: actionlint exits 0 on this file locally (shellcheck
integration active), and the lint step's body — checksum, tar, actionlint — was
run on ubuntu:24.04, the family ubuntu-latest runs on, with the pinned digest
confirmed against the published artifact (sha256sum -c: OK). What is still not
verified is the workflow running on a GitHub runner: the repository has no
remote.
2026-10-01 11:47:48 +02:00

105 lines
3.8 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: every command below was run locally on the
# commit that added it and passed. The workflow has not 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.
#
# 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.
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
- name: Restore
run: dotnet restore dotnet/OpenWaf.slnx
# TreatWarningsAsErrors is set in Directory.Build.props, so this is also
# the warning gate.
- name: Build
run: dotnet build dotnet/OpenWaf.slnx -c Release --no-restore
- name: Unit tests — the decision core
run: dotnet test dotnet/OpenWaf.Tests.Unit/OpenWaf.Tests.Unit.csproj -c Release --no-build
- name: Integration tests — the real pipeline against a fake upstream
run: dotnet test dotnet/OpenWaf.Tests.Integration/OpenWaf.Tests.Integration.csproj -c Release --no-build
- name: Smoke — a running edge and a real upstream, curl assertions
run: ./scripts/smoke.sh
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: this is the step that catches
# a Dockerfile regression the compose path would hide.
- name: docker build
run: docker build -t openwaf:ci .
- name: Image size
run: docker image ls openwaf:ci --format '{{.Repository}}:{{.Tag}} {{.Size}}'
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts 24
# things over a socket, and tears the stack down on exit.
- name: Compose smoke — the deployed image
run: ./scripts/compose-smoke.sh