Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m28s
Foundation / postgres-tools (push) Successful in 32s
Foundation / server-image (push) Successful in 4m3s
Foundation / image (push) Successful in 4m10s
Gameplay iteration needs images on DEV in minutes. A push to main now runs only the deploy policy suite before the image jobs; the full check matrix runs nightly, on pull requests and on manual dispatch, in its own concurrency group. Refreshes the DEV session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
214 lines
10 KiB
YAML
214 lines
10 KiB
YAML
name: Foundation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
# The full check matrix runs nightly; pushes only gate on the deploy policy suite.
|
|
schedule:
|
|
- cron: '0 9 * * *'
|
|
|
|
# Do not spend a full build on obsolete commits when pushes arrive quickly. Nightly runs
|
|
# use their own group so a push does not cancel them.
|
|
concurrency:
|
|
group: foundation-${{ github.event_name }}-${{ gitea.ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
code: read
|
|
|
|
env:
|
|
UBUNTU_IMAGE: ${{ vars.UBUNTU_IMAGE || 'ubuntu:24.04' }}
|
|
HARBOR_PROJECT: ${{ vars.HARBOR_PROJECT || 'aeternalis' }}
|
|
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
|
|
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
|
|
CACHE_WRITE: '0'
|
|
# Change selection (tools/ci/ci-paths.sh) compares against the event's real base:
|
|
# the push's before SHA or the pull request's base; manual runs always run.
|
|
CI_EVENT: ${{ github.event_name }}
|
|
CI_BEFORE: ${{ github.event.before }}
|
|
CI_PR_BASE: ${{ github.event.pull_request.base.sha }}
|
|
|
|
jobs:
|
|
checks:
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
# Captured cold/shared-runner checks reached 59 minutes before the ASan
|
|
# cohort timeout, with the remaining fuzz/benchmark steps still pending.
|
|
# Successful full runs grew from 67 to 78 minutes through M12; run 469
|
|
# (photosynthesis) reached the old 90-minute limit, so the job has headroom again.
|
|
timeout-minutes: 120
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
suite: [checks, tsan, ecs, postgres, deploy, client, network]
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
- name: Build and execute Linux checks
|
|
env:
|
|
CHECK_SUITE: ${{ matrix.suite }}
|
|
run: |
|
|
set -eu
|
|
# Gameplay iteration (2026-10-21): a push publishes images after the deploy policy
|
|
# suite alone. The full matrix runs nightly, on pull requests and on dispatch.
|
|
if [ "$CI_EVENT" = push ] && [ "$CHECK_SUITE" != deploy ]; then
|
|
echo "Push build: $CHECK_SUITE runs nightly or on dispatch; gate skipped."
|
|
exit 0
|
|
fi
|
|
# The selector's own regression runs first, so a broken selector cannot
|
|
# silently skip the suites.
|
|
if [ "$CHECK_SUITE" = deploy ]; then bash tools/ci/ci-paths-check.sh; fi
|
|
if ! bash tools/ci/ci-paths.sh "$CHECK_SUITE"; then
|
|
echo "No files relevant to $CHECK_SUITE changed; gate skipped."
|
|
exit 0
|
|
fi
|
|
docker version
|
|
if [ "$CHECK_SUITE" = postgres ]; then
|
|
# The PostgreSQL stages compile with PG_BUILD_JOBS=6 (deploy/docker/Dockerfile);
|
|
# each clang ASan/analysis job can take 1-2 GiB. Record the runner's real CPU,
|
|
# memory and disk headroom so an eviction or cache loss is attributable.
|
|
echo "runner: nproc=$(nproc) memory.max=$(cat /sys/fs/cgroup/memory.max 2>/dev/null || echo unknown)"
|
|
df -h "$(docker info --format '{{.DockerRootDir}}')" "${RUNNER_TEMP:-/tmp}" || true
|
|
docker buildx du 2>/dev/null | tail -n 3 || true
|
|
fi
|
|
ci_image="aevolution-ci:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-$CHECK_SUITE"
|
|
if [[ "${GITHUB_REF:-}" == refs/heads/main && "${GITHUB_EVENT_NAME:-}" != pull_request && -n "${HARBOR_USERNAME:-}" ]]; then
|
|
export CACHE_WRITE=1
|
|
fi
|
|
bash tools/ci/docker-build.sh "ci-$CHECK_SUITE" "$ci_image" aevolution-ci-cache
|
|
if [ "$CHECK_SUITE" = tsan ]; then
|
|
profile="$RUNNER_TEMP/aevolution-tsan-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.json"
|
|
node tools/ci/tsan-profile.mjs "$profile"
|
|
docker run --rm --network none --read-only --user 10001:10001 \
|
|
--env EVO_TEST_TMPDIR=/tmp \
|
|
--cap-drop ALL --security-opt no-new-privileges \
|
|
--security-opt "seccomp=$profile" \
|
|
--tmpfs /source/build/tsan/Testing:rw,noexec,nosuid,size=16m,mode=1777 \
|
|
--tmpfs /source/build/tsan/cli-integration:rw,noexec,nosuid,size=16m,mode=1777 \
|
|
--tmpfs /source/build/tsan/world-proof:rw,noexec,nosuid,size=16m,mode=1777 \
|
|
--tmpfs /tmp:rw,noexec,nosuid,size=16m,mode=1777 "$ci_image"
|
|
fi
|
|
|
|
postgres-tools:
|
|
needs: [checks]
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 40
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
with:
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
- name: Build and smoke-test migration tooling
|
|
run: |
|
|
set -eu
|
|
if ! bash tools/ci/ci-paths.sh postgres-tools; then
|
|
echo 'No migration-tool files changed; gate skipped.'
|
|
exit 0
|
|
fi
|
|
image="aevolution-postgres-tools:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
if [[ "${GITHUB_REF:-}" == refs/heads/main && "${GITHUB_EVENT_NAME:-}" != pull_request && -n "${HARBOR_USERNAME:-}" ]]; then
|
|
export CACHE_WRITE=1
|
|
fi
|
|
bash tools/ci/docker-build.sh postgres-tools "$image" aevolution-postgres-cache
|
|
docker run --rm --network none --read-only --cap-drop ALL \
|
|
--entrypoint /opt/postgres/bin/psql "$image" --version
|
|
docker run --rm --network none --read-only --cap-drop ALL \
|
|
--entrypoint /opt/postgres/bin/pg_dump "$image" --version
|
|
- name: Publish configured migration tools
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_POSTGRES_REPOSITORY != '' }}
|
|
env:
|
|
HARBOR_REPOSITORY: ${{ vars.HARBOR_POSTGRES_REPOSITORY }}
|
|
run: |
|
|
export SOURCE_IMAGE="aevolution-postgres-tools:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
if ! docker image inspect "$SOURCE_IMAGE" >/dev/null 2>&1; then
|
|
echo 'Migration-tools build was skipped; nothing to publish.'
|
|
exit 0
|
|
fi
|
|
bash tools/ci/publish-image.sh
|
|
|
|
server-image:
|
|
needs: [checks]
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
with:
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
- name: Build and smoke-test the region server image
|
|
run: |
|
|
set -eu
|
|
if ! bash tools/ci/ci-paths.sh server-image; then
|
|
echo 'No server-image files changed; gate skipped.'
|
|
exit 0
|
|
fi
|
|
image="aevolution-server:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
if [[ "${GITHUB_REF:-}" == refs/heads/main && "${GITHUB_EVENT_NAME:-}" != pull_request && -n "${HARBOR_USERNAME:-}" ]]; then
|
|
export CACHE_WRITE=1
|
|
fi
|
|
bash tools/ci/docker-build.sh server-runtime "$image" aevolution-server-cache
|
|
bash tools/ci/server-image-smoke.sh "$image"
|
|
- name: Publish configured region server image
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_SERVER_REPOSITORY != '' }}
|
|
env:
|
|
HARBOR_REPOSITORY: ${{ vars.HARBOR_SERVER_REPOSITORY }}
|
|
run: |
|
|
export SOURCE_IMAGE="aevolution-server:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
if ! docker image inspect "$SOURCE_IMAGE" >/dev/null 2>&1; then
|
|
echo 'Server-image build was skipped; nothing to publish.'
|
|
exit 0
|
|
fi
|
|
bash tools/ci/publish-image.sh
|
|
- name: Explain disabled server-image publishing
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_SERVER_REPOSITORY == '' }}
|
|
run: |
|
|
echo "Server image was not pushed to Harbor: set the HARBOR_SERVER_REPOSITORY Gitea variable."
|
|
|
|
image:
|
|
needs: [checks]
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
- name: Build and smoke-test runtime
|
|
run: |
|
|
set -eu
|
|
if ! bash tools/ci/ci-paths.sh image; then
|
|
echo 'No runtime-image files changed; gate skipped.'
|
|
exit 0
|
|
fi
|
|
image="aevolution-proof:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
if [[ "${GITHUB_REF:-}" == refs/heads/main && "${GITHUB_EVENT_NAME:-}" != pull_request && -n "${HARBOR_USERNAME:-}" ]]; then
|
|
export CACHE_WRITE=1
|
|
fi
|
|
bash tools/ci/docker-build.sh runtime "$image" aevolution-image-cache \
|
|
--build-arg "UBUNTU_IMAGE=$UBUNTU_IMAGE" \
|
|
--label "org.opencontainers.image.revision=$GITHUB_SHA" \
|
|
--label "org.opencontainers.image.source=https://git.aeternalisgames.com/dingo/AEvolution"
|
|
docker run --rm --network none --read-only --cap-drop ALL \
|
|
--security-opt no-new-privileges "$image" \
|
|
--seed 123456 --entities 8 --ticks 1000 --verify-replay
|
|
- name: Publish configured main build to Harbor
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_PROJECT != '' }}
|
|
env:
|
|
HARBOR_REPOSITORY: ${{ vars.HARBOR_REPOSITORY || 'aevolution' }}
|
|
run: |
|
|
if ! docker image inspect "aevolution-proof:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >/dev/null 2>&1; then
|
|
echo 'Runtime-image build was skipped; nothing to publish.'
|
|
exit 0
|
|
fi
|
|
bash tools/ci/publish-image.sh
|
|
- name: Explain unconfigured publishing
|
|
if: ${{ vars.HARBOR_PROJECT == '' }}
|
|
run: echo 'Image build/smoke only. Set HARBOR_PROJECT and Harbor robot secrets to enable main publishing. See deploy/README.md.'
|