Heimdall Gitea / Build and tests (push) Successful in 19m55s
Heimdall Gitea / Detect CI scope (push) Successful in 1m1s
Heimdall Gitea / Build and scan server image (push) Successful in 9m7s
Heimdall Gitea / Build and scan agent image (push) Successful in 12m27s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 19m7s
Heimdall Gitea / Publish versioned installer release (push) Successful in 5m47s
Heimdall Gitea / CI policy (push) Successful in 6s
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
362 lines
16 KiB
YAML
362 lines
16 KiB
YAML
name: Heimdall Gitea
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
tags: ['*.*.*']
|
|
permissions:
|
|
contents: read
|
|
concurrency:
|
|
group: heimdall-${{ gitea.ref }}
|
|
cancel-in-progress: false
|
|
env:
|
|
BUILD_SERVER_URL: ${{ gitea.server_url }}
|
|
BUILD_REPOSITORY: ${{ gitea.repository }}
|
|
jobs:
|
|
changes:
|
|
name: Detect CI scope
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
outputs:
|
|
run_validation: ${{ steps.filter.outputs.run_validation }}
|
|
build_server: ${{ steps.filter.outputs.build_server }}
|
|
build_agent: ${{ steps.filter.outputs.build_agent }}
|
|
build_agent_gpu: ${{ steps.filter.outputs.build_agent_gpu }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Detect changed projects and images
|
|
id: filter
|
|
env:
|
|
PR_BASE_SHA: ${{ gitea.event.pull_request.base.sha }}
|
|
PUSH_BEFORE_SHA: ${{ gitea.event.before }}
|
|
CURRENT_SHA: ${{ gitea.sha }}
|
|
EVENT_NAME: ${{ gitea.event_name }}
|
|
REF: ${{ gitea.ref }}
|
|
run: python3 scripts/ci/change_scope.py
|
|
policy:
|
|
name: CI policy
|
|
if: always()
|
|
needs: [changes, verify, server_image, agent_image, agent_gpu_image, publish]
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
steps:
|
|
- name: Require all applicable validation jobs to pass
|
|
env:
|
|
CHANGE_RESULT: ${{ needs.changes.result }}
|
|
RUN_VALIDATION: ${{ needs.changes.outputs.run_validation }}
|
|
VERIFY_RESULT: ${{ needs.verify.result }}
|
|
SERVER_IMAGE_RESULT: ${{ needs.server_image.result }}
|
|
AGENT_IMAGE_RESULT: ${{ needs.agent_image.result }}
|
|
AGENT_GPU_IMAGE_RESULT: ${{ needs.agent_gpu_image.result }}
|
|
RELEASE_RESULT: ${{ needs.publish.result }}
|
|
EVENT_NAME: ${{ gitea.event_name }}
|
|
REF: ${{ gitea.ref }}
|
|
run: |
|
|
set -eu
|
|
test "$CHANGE_RESULT" = success
|
|
|
|
if [ "$RUN_VALIDATION" != true ]; then
|
|
echo 'No source, test, build, or deployment inputs changed.'
|
|
exit 0
|
|
fi
|
|
|
|
test "$VERIFY_RESULT" = success
|
|
if [ "${{ needs.changes.outputs.build_server }}" = true ]; then test "$SERVER_IMAGE_RESULT" = success; fi
|
|
if [ "${{ needs.changes.outputs.build_agent }}" = true ]; then test "$AGENT_IMAGE_RESULT" = success; fi
|
|
if [ "${{ needs.changes.outputs.build_agent_gpu }}" = true ]; then test "$AGENT_GPU_IMAGE_RESULT" = success; fi
|
|
case "$EVENT_NAME:$REF" in
|
|
push:refs/tags/*) test "$RELEASE_RESULT" = success ;;
|
|
esac
|
|
verify:
|
|
name: Build and tests
|
|
if: needs.changes.outputs.run_validation == 'true'
|
|
needs: [changes]
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:fe0fd4e93bd2fbb47c883b7a6369e5c8d3db8bf01cdc5981f6ee35fbdf3ff4fb
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
|
|
env:
|
|
POSTGRES_DB: postgres
|
|
POSTGRES_USER: heimdall_ci
|
|
POSTGRES_PASSWORD: ephemeral-ci-only
|
|
options: --health-cmd 'pg_isready -U heimdall_ci -d postgres' --health-interval 5s --health-timeout 5s --health-retries 20
|
|
env:
|
|
DATABASE_URL: Host=postgres;Port=5432;Database=postgres;Username=heimdall_ci;Password=ephemeral-ci-only
|
|
PGHOST: postgres
|
|
PGUSER: heimdall_ci
|
|
PGPASSWORD: ephemeral-ci-only
|
|
PGDATABASE: postgres
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
|
|
DOTNET_NOLOGO: '1'
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
BUILD_REPOSITORY: ${{ gitea.repository }}
|
|
BUILD_RUN_ID: ${{ gitea.run_id }}
|
|
GITEA_EVENT_NAME: ${{ gitea.event_name }}
|
|
steps:
|
|
- name: Prepare action runtime before checkout
|
|
run: |
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git ca-certificates xz-utils
|
|
test "$(uname -m)" = x86_64
|
|
curl --fail --silent --show-error --location https://nodejs.org/dist/v22.23.3/node-v22.23.3-linux-x64.tar.xz -o /tmp/node.tar.xz
|
|
echo 'df450af89261115ef9f9e3830c3eeb2cc9213b63c720b1af623cb5dcbe2e02de /tmp/node.tar.xz' | sha256sum --check
|
|
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
|
ln -sf /usr/local/bin/node /usr/bin/node
|
|
rm /tmp/node.tar.xz
|
|
node --version
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Runner prerequisites
|
|
run: bash scripts/ci/bootstrap.sh
|
|
- name: Reclaim old Heimdall build storage
|
|
run: bash scripts/ci/cleanup-docker.sh before
|
|
- name: CI script contracts
|
|
run: |
|
|
python3 -m unittest discover -s scripts/ci -p 'test_*.py'
|
|
python3 scripts/ci/check-efcore-usage.py
|
|
- name: Validate Compose and restore .NET solution
|
|
run: |
|
|
mkdir -p artifacts/tests artifacts/security
|
|
dotnet --info > artifacts/dotnet-info.txt
|
|
bash scripts/ci/validate-compose.sh
|
|
dotnet restore Heimdall.slnx --locked-mode
|
|
- name: Plan affected test suites
|
|
run: python3 scripts/ci/test-plan.py
|
|
- name: Build affected projects
|
|
run: python3 scripts/ci/build-plan.py
|
|
- name: Agent tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.Agent.Tests
|
|
- name: API tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.Api.Tests
|
|
- name: Application tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.Application.Tests
|
|
- name: Domain tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.Domain.Tests
|
|
- name: Infrastructure tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.Infrastructure.Tests
|
|
- name: Integration tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.IntegrationTests
|
|
- name: Web tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.Web.Tests
|
|
- name: Camera access coverage gate
|
|
run: python3 scripts/ci/check-camera-access-coverage.py artifacts/tests artifacts/tests/plan.json
|
|
- name: Browser tests
|
|
run: bash scripts/ci/test-suite.sh Heimdall.E2E.Tests
|
|
- name: NuGet dependency security gate
|
|
run: bash scripts/ci/security.sh dependencies --no-restore
|
|
- name: Reclaim build storage after job
|
|
if: always()
|
|
run: |
|
|
if test -f scripts/ci/cleanup-docker.sh && command -v docker >/dev/null 2>&1; then
|
|
bash scripts/ci/cleanup-docker.sh after
|
|
fi
|
|
server_image:
|
|
name: Build and scan server image
|
|
if: needs.changes.outputs.run_validation == 'true' && needs.changes.outputs.build_server == 'true'
|
|
needs: [changes, verify]
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:fe0fd4e93bd2fbb47c883b7a6369e5c8d3db8bf01cdc5981f6ee35fbdf3ff4fb
|
|
steps:
|
|
- name: Prepare action runtime before checkout
|
|
run: |
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git ca-certificates xz-utils
|
|
test "$(uname -m)" = x86_64
|
|
curl --fail --silent --show-error --location https://nodejs.org/dist/v22.23.3/node-v22.23.3-linux-x64.tar.xz -o /tmp/node.tar.xz
|
|
echo 'df450af89261115ef9f9e3830c3eeb2cc9213b63c720b1af623cb5dcbe2e02de /tmp/node.tar.xz' | sha256sum --check
|
|
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
|
ln -sf /usr/local/bin/node /usr/bin/node
|
|
rm /tmp/node.tar.xz
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Runner prerequisites
|
|
run: bash scripts/ci/bootstrap.sh
|
|
- name: Reclaim old build storage
|
|
run: bash scripts/ci/cleanup-docker.sh before
|
|
- name: Build server image
|
|
env:
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
run: bash scripts/ci/images.sh server
|
|
- name: Scan server image
|
|
run: bash scripts/ci/security.sh server
|
|
- name: Push immutable server image to Docker Hub
|
|
if: gitea.event_name == 'push' && (gitea.ref == 'refs/heads/main' || startsWith(gitea.ref, 'refs/tags/'))
|
|
env:
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
run: bash scripts/ci/push-images.sh server
|
|
- name: Reclaim build storage after job
|
|
if: always()
|
|
run: |
|
|
if test -f scripts/ci/cleanup-docker.sh && command -v docker >/dev/null 2>&1; then
|
|
bash scripts/ci/cleanup-docker.sh after
|
|
fi
|
|
agent_image:
|
|
name: Build and scan agent image
|
|
if: needs.changes.outputs.run_validation == 'true' && needs.changes.outputs.build_agent == 'true'
|
|
needs: [changes, verify]
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:fe0fd4e93bd2fbb47c883b7a6369e5c8d3db8bf01cdc5981f6ee35fbdf3ff4fb
|
|
steps:
|
|
- name: Prepare action runtime before checkout
|
|
run: |
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git ca-certificates xz-utils
|
|
test "$(uname -m)" = x86_64
|
|
curl --fail --silent --show-error --location https://nodejs.org/dist/v22.23.3/node-v22.23.3-linux-x64.tar.xz -o /tmp/node.tar.xz
|
|
echo 'df450af89261115ef9f9e3830c3eeb2cc9213b63c720b1af623cb5dcbe2e02de /tmp/node.tar.xz' | sha256sum --check
|
|
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
|
ln -sf /usr/local/bin/node /usr/bin/node
|
|
rm /tmp/node.tar.xz
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Runner prerequisites
|
|
run: bash scripts/ci/bootstrap.sh
|
|
- name: Reclaim old build storage
|
|
run: bash scripts/ci/cleanup-docker.sh before
|
|
- name: Build agent image
|
|
env:
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
run: bash scripts/ci/images.sh agent
|
|
- name: Scan agent image
|
|
run: bash scripts/ci/security.sh agent
|
|
- name: Push immutable agent image to Docker Hub
|
|
if: gitea.event_name == 'push' && (gitea.ref == 'refs/heads/main' || startsWith(gitea.ref, 'refs/tags/'))
|
|
env:
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
run: bash scripts/ci/push-images.sh agent
|
|
- name: Reclaim build storage after job
|
|
if: always()
|
|
run: |
|
|
if test -f scripts/ci/cleanup-docker.sh && command -v docker >/dev/null 2>&1; then
|
|
bash scripts/ci/cleanup-docker.sh after
|
|
fi
|
|
agent_gpu_image:
|
|
name: Build and scan NVIDIA Agent image
|
|
if: needs.changes.outputs.run_validation == 'true' && needs.changes.outputs.build_agent_gpu == 'true'
|
|
needs: [changes, verify]
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:fe0fd4e93bd2fbb47c883b7a6369e5c8d3db8bf01cdc5981f6ee35fbdf3ff4fb
|
|
steps:
|
|
- name: Prepare action runtime before checkout
|
|
run: |
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git ca-certificates xz-utils
|
|
test "$(uname -m)" = x86_64
|
|
curl --fail --silent --show-error --location https://nodejs.org/dist/v22.23.3/node-v22.23.3-linux-x64.tar.xz -o /tmp/node.tar.xz
|
|
echo 'df450af89261115ef9f9e3830c3eeb2cc9213b63c720b1af623cb5dcbe2e02de /tmp/node.tar.xz' | sha256sum --check
|
|
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
|
ln -sf /usr/local/bin/node /usr/bin/node
|
|
rm /tmp/node.tar.xz
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Runner prerequisites
|
|
run: bash scripts/ci/bootstrap.sh
|
|
- name: Reclaim old build storage
|
|
run: bash scripts/ci/cleanup-docker.sh before
|
|
- name: Build NVIDIA Agent image
|
|
env:
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
run: bash scripts/ci/images.sh agent-gpu
|
|
- name: Scan NVIDIA Agent image
|
|
run: bash scripts/ci/security.sh agent-gpu
|
|
- name: Push immutable NVIDIA Agent image to Docker Hub
|
|
if: gitea.event_name == 'push' && (gitea.ref == 'refs/heads/main' || startsWith(gitea.ref, 'refs/tags/'))
|
|
env:
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
run: bash scripts/ci/push-images.sh agent-gpu
|
|
- name: Reclaim build storage after job
|
|
if: always()
|
|
run: |
|
|
if test -f scripts/ci/cleanup-docker.sh && command -v docker >/dev/null 2>&1; then
|
|
bash scripts/ci/cleanup-docker.sh after
|
|
fi
|
|
publish:
|
|
name: Publish versioned installer release
|
|
if: needs.changes.outputs.run_validation == 'true' && startsWith(gitea.ref, 'refs/tags/')
|
|
needs: [changes, verify, server_image, agent_image, agent_gpu_image]
|
|
runs-on: [ubuntu-latest, build-agent]
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:fe0fd4e93bd2fbb47c883b7a6369e5c8d3db8bf01cdc5981f6ee35fbdf3ff4fb
|
|
permissions:
|
|
contents: write
|
|
pull-requests: read
|
|
actions: read
|
|
steps:
|
|
- name: Prepare action runtime before checkout
|
|
run: |
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git ca-certificates xz-utils
|
|
test "$(uname -m)" = x86_64
|
|
curl --fail --silent --show-error --location https://nodejs.org/dist/v22.23.3/node-v22.23.3-linux-x64.tar.xz -o /tmp/node.tar.xz
|
|
echo 'df450af89261115ef9f9e3830c3eeb2cc9213b63c720b1af623cb5dcbe2e02de /tmp/node.tar.xz' | sha256sum --check
|
|
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
|
ln -sf /usr/local/bin/node /usr/bin/node
|
|
rm /tmp/node.tar.xz
|
|
node --version
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- run: bash scripts/ci/bootstrap.sh
|
|
- name: Build versioned installer and Agent archives
|
|
env:
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
BUILD_REPOSITORY: ${{ gitea.repository }}
|
|
BUILD_RUN_ID: ${{ gitea.run_id }}
|
|
run: bash scripts/ci/package.sh
|
|
- name: Generate changes since the previous version tag
|
|
run: |
|
|
current_tag="${GITEA_REF#refs/tags/}"
|
|
previous_tag="$(git tag --merged "$CURRENT_SHA" --sort=-version:refname | sed -n '/^[0-9][0-9]*\.[0-9]/p' | grep -Fvx "$current_tag" | head -n 1 || true)"
|
|
if [ -n "$previous_tag" ]; then
|
|
BEFORE_SHA="$(git rev-list -n 1 "$previous_tag")"
|
|
else
|
|
BEFORE_SHA="$(git rev-list --max-parents=0 "$CURRENT_SHA" | tail -n 1)"
|
|
fi
|
|
export BEFORE_SHA CURRENT_SHA GITEA_TOKEN BUILD_SERVER_URL BUILD_REPOSITORY
|
|
python3 scripts/ci/release-notes.py
|
|
env:
|
|
GITEA_REF: ${{ gitea.ref }}
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
BUILD_SERVER_URL: ${{ gitea.server_url }}
|
|
BUILD_REPOSITORY: ${{ gitea.repository }}
|
|
CURRENT_SHA: ${{ gitea.sha }}
|
|
- name: Publish signed release assets
|
|
env:
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
BUILD_REPOSITORY: ${{ gitea.repository }}
|
|
BUILD_SERVER_URL: ${{ gitea.server_url }}
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
RELEASE_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
RELEASE_SIGNING_KEY_B64: ${{ secrets.RELEASE_SIGNING_KEY_B64 }}
|
|
EXPECTED_BUILD_SERVER_URL: ${{ vars.RELEASE_SERVER_URL }}
|
|
RELEASE_NOTES_FILE: artifacts/release-notes.md
|
|
RELEASE_TAG: ${{ gitea.ref_name }}
|
|
run: bash scripts/ci/publish.sh
|
|
- name: Reclaim build storage after release
|
|
if: always()
|
|
run: bash scripts/ci/cleanup-docker.sh after
|