Files
Anubis/.gitea/workflows/ci.yml
T
Alby96andClaude Opus 5.5 d00dfbd32f Add the guard that watches the engine and protects positions (refs #48)
The guard (SPEC 9.3, 9.4) is now the container's main process and the parent
of the engine. It listens on a named pipe for the engine's heartbeat and
startup steps, and steps in after two minutes of silence, ten minutes of a
startup that does not move, or an exit without notice. It stops the engine,
cancels our purchases and sales left open on demo accounts, puts back the
stops the positions need from the state file the engine writes every ten
seconds, writes a note, warns the user and restarts the engine without any
injected fault. The third forced restart within an hour writes the STOP
file. The container's stop is passed on to the engine, which closes in order.

At restart the engine adopts the guard's stops before reconciling, cancels
the orders it left open and plans again the exits already decided, so the
rules of SPEC 5.6 apply to them.

The acceptance test blocks the main loop right after a sale leaves: in
process on a demo-like broker, and with real processes in the drill, which
also runs inside the Docker image (tasks ci and the CI workflow). The guard
uses the ASP.NET shared runtime so both programs share /app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 19:36:32 +01:00

69 lines
2.3 KiB
YAML

# CI (SPEC 15.5, ADR 0003/0004): only run steps with git, dotnet and docker, no external actions.
# Publishing to the registry on v* tags arrives in phase 9 (issue #70).
name: ci
on:
push:
branches: ["**"]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
strategy:
fail-fast: false
matrix:
db: [sqlite, postgres]
services:
postgres:
image: postgres:18
env:
POSTGRES_DB: anubis
POSTGRES_USER: anubis
POSTGRES_PASSWORD: anubis-ci
options: >-
--health-cmd "pg_isready -U anubis -d anubis"
--health-interval 3s
--health-timeout 3s
--health-retries 20
env:
ANUBIS_TEST_DB: ${{ matrix.db }}
ANUBIS_TEST_PG_HOST: postgres
ANUBIS_TEST_PG_PORT: "5432"
ANUBIS_TEST_PG_PASSWORD: anubis-ci
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
DOTNET_NOLOGO: "1"
TESTINGPLATFORM_TELEMETRY_OPTOUT: "1"
steps:
- name: Checkout
run: |
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch -q --depth 1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
- name: Check
run: sh ./tasks.sh check
image:
needs: test
runs-on: ubuntu-latest
# Registry settings for phase 9 (issue #70): declared here, not used before then.
env:
REGISTRY: gitea.encke-hake.ts.net
REGISTRY_USER: ${{ github.repository_owner }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
steps:
- name: Checkout
run: |
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch -q --depth 1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
- name: Build image (no publish)
run: docker build -f deploy/docker/Dockerfile -t anubis:ci .
# The guard drill inside the image (issue #48): offline, its own SQLite database in a temporary folder.
- name: Guard drill in the image
run: docker run --rm anubis:ci drill