100 lines
3.8 KiB
YAML
100 lines
3.8 KiB
YAML
name: Heimdall Gitea
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main, 'audit-build-*']
|
|
tags: ['v*']
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
verify:
|
|
name: Build and tests
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:0d99ebf1ccad15037b5c98c9fe8979d6b8dbac23812feae2277a0b277b5c5ffa
|
|
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 }}
|
|
steps:
|
|
- 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: NuGet cache
|
|
uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: ~/.nuget/packages
|
|
key: nuget-linux-${{ hashFiles('**/packages.lock.json', 'global.json') }}
|
|
- name: Compile and run every test suite
|
|
run: bash scripts/ci/verify.sh
|
|
- name: Publish server PWA and agent archives
|
|
run: bash scripts/ci/package.sh
|
|
- name: Build server and CPU agent images
|
|
run: bash scripts/ci/images.sh
|
|
- name: Dependency and image security gates
|
|
if: always()
|
|
run: bash scripts/ci/security.sh
|
|
- name: Retain evidence even on failure
|
|
if: always()
|
|
uses: https://github.com/christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # Gitea v4 adapter
|
|
with:
|
|
name: heimdall-${{ gitea.sha }}
|
|
path: |
|
|
artifacts/packages/
|
|
artifacts/tests/
|
|
artifacts/security/
|
|
artifacts/dotnet-info.txt
|
|
retention-days: 14
|
|
if-no-files-found: error
|
|
publish:
|
|
name: Publish versioned release
|
|
if: startsWith(gitea.ref, 'refs/tags/v')
|
|
needs: [verify]
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:0d99ebf1ccad15037b5c98c9fe8979d6b8dbac23812feae2277a0b277b5c5ffa
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- run: bash scripts/ci/bootstrap.sh
|
|
- name: Require a release from main history
|
|
run: git merge-base --is-ancestor HEAD origin/main
|
|
- name: Retrieve tested archives
|
|
uses: https://github.com/christopherhx/gitea-download-artifact@75635f32b4c1c41c4b3d64e8f85210112ed4c9c7 # Gitea v4 adapter
|
|
with:
|
|
name: heimdall-${{ gitea.sha }}
|
|
path: artifacts
|
|
- name: Publish immutable images and draft release
|
|
env:
|
|
BUILD_REF: ${{ gitea.ref }}
|
|
BUILD_REPOSITORY: ${{ gitea.repository }}
|
|
BUILD_SERVER_URL: ${{ gitea.server_url }}
|
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
run: bash scripts/ci/publish.sh
|