Publish the image on version tags and test what is delivered
A v* tag now builds, tries and publishes the image: the version must be the one of Directory.Build.props, latest only moves forward and the registry token is in one step, given to docker on its input. The same script works by hand. The image says its version and commit, and its health check also covers the engine loop and the live prices. The Unraid template is final: a test compares it with appendix E and with the variables the loader really reads, and another reads the workflow. refs #70 refs #71 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d92a39fef
commit
3cd214ae78
16 files changed
+859
-27
No files matched your search
+38
-10
@@ -1,10 +1,11 @@
|
||||
# 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).
|
||||
# The image is published only on v* tags, after the tests and the drill (SPEC 15.5, ADR 0002 and 0020); never on fase-N.
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
@@ -44,10 +45,15 @@ jobs:
|
||||
TESTINGPLATFORM_TELEMETRY_OPTOUT: "1"
|
||||
steps:
|
||||
- name: Checkout
|
||||
# The token goes to git through its environment, so it is on no command line.
|
||||
env:
|
||||
GIT_CONFIG_COUNT: "1"
|
||||
GIT_CONFIG_KEY_0: http.extraHeader
|
||||
GIT_CONFIG_VALUE_0: "Authorization: token ${{ github.token }}"
|
||||
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 fetch -q --depth 1 origin "${{ github.sha }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
- name: Check
|
||||
run: sh ./tasks.sh check
|
||||
@@ -59,20 +65,42 @@ jobs:
|
||||
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 }}
|
||||
# The Docker daemon of the runner is shared between runs: a name of this run only, so what is published is what was tried.
|
||||
IMAGE: anubis:ci-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
# The token goes to git through its environment, so it is on no command line.
|
||||
env:
|
||||
GIT_CONFIG_COUNT: "1"
|
||||
GIT_CONFIG_KEY_0: http.extraHeader
|
||||
GIT_CONFIG_VALUE_0: "Authorization: token ${{ github.token }}"
|
||||
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 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 .
|
||||
- name: Build image
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
case "$REF" in refs/tags/v*) version=${REF_NAME#v} ;; *) version=dev ;; esac
|
||||
docker build -f deploy/docker/Dockerfile --build-arg "ANUBIS_VERSION=$version" --build-arg "ANUBIS_COMMIT=$(git rev-parse HEAD)" -t "$IMAGE" .
|
||||
# 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
|
||||
run: docker run --rm "$IMAGE" drill
|
||||
- name: Publish image
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
REGISTRY: ${{ vars.REGISTRY || 'gitea.encke-hake.ts.net' }}
|
||||
REGISTRY_USER: ${{ vars.REGISTRY_USER || github.actor }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
GIT_CONFIG_COUNT: "1"
|
||||
GIT_CONFIG_KEY_0: http.extraHeader
|
||||
GIT_CONFIG_VALUE_0: "Authorization: token ${{ github.token }}"
|
||||
run: sh ./deploy/docker/publish.sh "$IMAGE" "$TAG"
|
||||
- name: Remove the image of this run
|
||||
if: always()
|
||||
run: docker image rm -f "$IMAGE" || true
|
||||
Reference in new issue
Block a user