The server log of a failing job shows every restart as 'untracked child process exited with exit code 2'. A health check that outlives its 3-second timeout leaves pg_isready to PostgreSQL, which is PID 1 in its container; when pg_isready exits the postmaster takes it for a crashed backend and restarts every connection. --init reaps such orphans, and pg_isready -t 5 under a 15-second timeout is never cut off. Same change in docker-compose.yml. ADR 0015. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
3.1 KiB
YAML
82 lines
3.1 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:
|
|
if: github.event_name == 'push' # TEMPORARY (issue #98): stress run, three suites on one server
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
db: [postgres] # TEMPORARY (issue #98)
|
|
services:
|
|
postgres:
|
|
image: postgres:18
|
|
env:
|
|
POSTGRES_DB: anubis
|
|
POSTGRES_USER: anubis
|
|
POSTGRES_PASSWORD: anubis-ci
|
|
# --init and a pg_isready that gives up before Docker does (ADR 0015, issue #98). Without them a health
|
|
# check that outlives its timeout leaves pg_isready to PostgreSQL as PID 1, and its exit restarts the server.
|
|
options: >-
|
|
--init
|
|
--health-cmd "pg_isready -U anubis -d anubis -t 5"
|
|
--health-interval 3s
|
|
--health-timeout 15s
|
|
--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
|
|
# TEMPORARY (issue #98): the PostgreSQL suite three times on the same server.
|
|
run: |
|
|
status=0
|
|
for i in 1 2 3; do echo "== round $i"; sh ./tasks.sh test -c Release || status=1; done
|
|
exit $status
|
|
# The log of the PostgreSQL service, read through the Docker socket the runner mounts in the job (issue #98).
|
|
- name: PostgreSQL log
|
|
if: always() && matrix.db == 'postgres'
|
|
run: sh ./tasks.sh ci-service-log postgres
|
|
|
|
image:
|
|
if: false # TEMPORARY (issue #98)
|
|
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
|