Files
aevolution/tools/ci/ci-paths-check.sh
T
dingo 8568eff39d
Foundation / checks (deploy) (push) Successful in 14s
Foundation / checks (ecs) (push) Successful in 2m3s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m17s
Foundation / checks (client) (push) Canceled after 5m17s
Foundation / checks (network) (push) Canceled after 2m57s
Add fenced durable primitive life reservations (M11.2c-1)
2026-10-09 21:55:28 -04:00

62 lines
3.6 KiB
Bash

#!/usr/bin/env bash
# Offline regression for tools/ci/ci-paths.sh (review M8 P2) in a disposable Git
# repository: multi-commit pushes ending in documentation, missing and unknown bases,
# pull requests, manual dispatch, and changes to only a check script. Uncertainty
# must run validation. Run by the deploy suite before it decides anything.
set -euo pipefail
script="$(cd "$(dirname "$0")" && pwd)/ci-paths.sh"
repo="$(mktemp -d /tmp/evo-ci-paths.XXXXXXXX)"
trap 'rm -rf -- "$repo"' EXIT
cd "$repo"
git init -q
git config user.email ci@example.invalid
git config user.name ci
mkdir -p src docs tools/ci
echo base > src/a.cpp; echo base > docs/a.md; echo base > tools/ci/dr-check.sh
git add .; git commit -qm base
base="$(git rev-parse HEAD)"
echo change >> src/a.cpp; git commit -qam implementation
echo change >> docs/a.md; git commit -qam documentation
docs_only_base="$(git rev-parse HEAD~1)"
failures=0
expect() { # expect <label> <0 run|1 skip> <env...> -- <suite>
local label="$1" want="$2"; shift 2
local envs=()
while [ "$1" != -- ]; do envs+=("$1"); shift; done
shift
local got=0
env -u GITHUB_EVENT_BEFORE -u GITHUB_EVENT_NAME -u CI_EVENT -u CI_BEFORE -u CI_PR_BASE \
"${envs[@]}" bash "$script" "$1" || got=$?
if [ "$got" = "$want" ]; then echo "ok $label"; else echo "FAIL $label: exit $got, wanted $want"; failures=$((failures + 1)); fi
}
expect "push: code then docs runs checks" 0 CI_EVENT=push "CI_BEFORE=$base" -- checks
expect "push: docs-only commit skips checks" 1 CI_EVENT=push "CI_BEFORE=$docs_only_base" -- checks
expect "push: no before SHA runs" 0 CI_EVENT=push -- checks
expect "push: all-zero before (new branch) runs" 0 CI_EVENT=push CI_BEFORE=0000000000000000000000000000000000000000 -- checks
expect "push: unknown, unfetchable base runs" 0 CI_EVENT=push CI_BEFORE=1111111111111111111111111111111111111111 -- checks
expect "pull request: base diff runs checks" 0 CI_EVENT=pull_request "CI_PR_BASE=$base" -- checks
expect "pull request: no base runs" 0 CI_EVENT=pull_request -- deploy
expect "manual dispatch always runs" 0 CI_EVENT=workflow_dispatch "CI_BEFORE=$docs_only_base" -- checks
expect "local run (no event) runs" 0 -- postgres
echo change >> tools/ci/dr-check.sh; git commit -qam dr-script
script_base="$(git rev-parse HEAD~1)"
expect "push: only dr-check.sh changed runs postgres" 0 CI_EVENT=push "CI_BEFORE=$script_base" -- postgres
expect "push: only dr-check.sh changed skips image" 1 CI_EVENT=push "CI_BEFORE=$script_base" -- image
life_base="$(git rev-parse HEAD)"
echo check > tools/ci/life-reservations-check.sql; git add .; git commit -qm life-check
expect "push: life reservation check runs postgres" 0 CI_EVENT=push "CI_BEFORE=$life_base" -- postgres
# Client dependency updates must select the isolated client gate.
mkdir -p tools
client_base="$(git rev-parse HEAD)"
echo pin > tools/sdl3-pin.cmake; git add .; git commit -qm client-pin
expect "push: SDL pin runs client" 0 CI_EVENT=push "CI_BEFORE=$client_base" -- client
ui_base="$(git rev-parse HEAD)"
echo pin > tools/imgui-pin.cmake; git add .; git commit -qm ui-pin
expect "push: ImGui pin runs client" 0 CI_EVENT=push "CI_BEFORE=$ui_base" -- client
# A TLS dependency update must select the isolated network gate, not only the image.
network_base="$(git rev-parse HEAD)"
echo pin > tools/mbedtls-pin.cmake; git add .; git commit -qm network-pin
expect "push: Mbed TLS pin runs network" 0 CI_EVENT=push "CI_BEFORE=$network_base" -- network
expect "push: Mbed TLS pin skips deploy" 1 CI_EVENT=push "CI_BEFORE=$network_base" -- deploy
[ "$failures" = 0 ] && echo "ci path selection fixtures passed" || { echo "$failures fixture(s) failed"; exit 1; }