6720c472c9
Both jobs were unschedulable, not just the Windows one: the registered runners are labelled windows-host / windows-server-host / powershell-windows and linux-host / ubuntu-host / powershell-linux, so neither "windows" nor "ubuntu-latest" matched anything and workflows sat blocked. - build-test and the release job now run on windows-host (Windows is required for the agent: CIM, ConPTY, DPAPI, Windows service, WiX) - the image build/publish job runs on ubuntu-host Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
151 lines
5.3 KiB
YAML
151 lines
5.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [dev, main]
|
|
|
|
jobs:
|
|
build-test:
|
|
# Windows is required to build/test the agent (CIM, ConPTY, DPAPI, service).
|
|
# Label must match a registered runner: windows-host.
|
|
runs-on: windows-host
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET 10
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Compute unified version
|
|
id: ver
|
|
shell: pwsh
|
|
run: |
|
|
$v = & ./scripts/Get-UnifiedVersion.ps1
|
|
"version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
|
Write-Host "Unified version: $v"
|
|
|
|
- name: Restore
|
|
run: dotnet restore ExecuteR.slnx
|
|
|
|
- name: Build
|
|
run: dotnet build ExecuteR.slnx -c Release --no-restore "-p:UnifiedVersion=${{ steps.ver.outputs.version }}"
|
|
|
|
- name: Unit tests
|
|
run: |
|
|
dotnet test tests/Shared.Tests -c Release --no-build --nologo
|
|
dotnet test tests/Agent.Tests -c Release --no-build --nologo
|
|
dotnet test tests/Backend.Tests -c Release --no-build --nologo
|
|
|
|
- name: Integration tests
|
|
run: dotnet test tests/Integration.Tests -c Release --no-build --nologo
|
|
|
|
- name: WebUI install
|
|
run: npm ci
|
|
working-directory: src/WebUI
|
|
|
|
- name: WebUI check
|
|
run: npm run check
|
|
working-directory: src/WebUI
|
|
|
|
- name: WebUI build
|
|
env:
|
|
PUBLIC_BUILD_VERSION: ${{ steps.ver.outputs.version }}
|
|
run: npm run build
|
|
working-directory: src/WebUI
|
|
|
|
images:
|
|
# Build the backend + webui images and publish them to the Gitea container
|
|
# registry. Image names match what docker-compose.yml pulls:
|
|
# <gitea-host>/<owner>/executer-backend:<tag>
|
|
# <gitea-host>/<owner>/executer-webui:<tag>
|
|
needs: build-test
|
|
if: ${{ github.event_name == 'push' }}
|
|
# Needs Docker; label must match a registered Linux runner.
|
|
runs-on: ubuntu-host
|
|
env:
|
|
# Gitea's built-in container registry lives on the Gitea host itself and
|
|
# needs no configuration: Actions injects GITEA_TOKEN per run and it is
|
|
# accepted as the registry password for the triggering actor.
|
|
# The REGISTRY_* secrets are only an override for an EXTERNAL registry.
|
|
REGISTRY_HOST: ${{ secrets.REGISTRY_HOST }}
|
|
REGISTRY_USER: ${{ secrets.REGISTRY_USERNAME }}
|
|
REGISTRY_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
ACTOR: ${{ github.actor }}
|
|
BUILTIN_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
OWNER: ${{ github.repository_owner }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Resolve version and registry target
|
|
id: ver
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
echo "version=$(date -u +%Y.%m.%d.%H%M)" >> "$GITHUB_OUTPUT"
|
|
|
|
# Default to Gitea's own registry on this instance; fall back to the
|
|
# REGISTRY_* secrets only when an external registry is configured.
|
|
if [ -n "$REGISTRY_HOST" ]; then
|
|
HOST="$REGISTRY_HOST"; USER="$REGISTRY_USER"; PASS="$REGISTRY_PASS"
|
|
echo "Using external registry $HOST"
|
|
else
|
|
HOST="$(echo "$SERVER_URL" | sed -E 's#^https?://##; s#/$##')"
|
|
USER="$ACTOR"; PASS="$BUILTIN_TOKEN"
|
|
echo "Using the built-in Gitea registry at $HOST"
|
|
fi
|
|
|
|
# Gitea package paths are lowercase.
|
|
OWNER_LC="$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')"
|
|
|
|
{
|
|
echo "host=$HOST"
|
|
echo "user=$USER"
|
|
echo "prefix=${HOST}/${OWNER_LC}/executer"
|
|
} >> "$GITHUB_OUTPUT"
|
|
echo "::add-mask::$PASS"
|
|
echo "REGISTRY_LOGIN_PASSWORD=$PASS" >> "$GITHUB_ENV"
|
|
|
|
- name: Registry login
|
|
run: echo "$REGISTRY_LOGIN_PASSWORD" | docker login "${{ steps.ver.outputs.host }}" -u "${{ steps.ver.outputs.user }}" --password-stdin
|
|
|
|
- name: Build images
|
|
env:
|
|
VERSION: ${{ steps.ver.outputs.version }}
|
|
PREFIX: ${{ steps.ver.outputs.prefix }}
|
|
run: |
|
|
set -e
|
|
docker build -f src/Infra/backend/Dockerfile --build-arg UNIFIED_VERSION="$VERSION" -t "${PREFIX}-backend:$VERSION" .
|
|
docker build -f src/Infra/webui/Dockerfile --build-arg UNIFIED_VERSION="$VERSION" -t "${PREFIX}-webui:$VERSION" .
|
|
|
|
- name: Tag and push
|
|
env:
|
|
VERSION: ${{ steps.ver.outputs.version }}
|
|
PREFIX: ${{ steps.ver.outputs.prefix }}
|
|
REF_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
set -e
|
|
for svc in backend webui; do
|
|
docker push "${PREFIX}-${svc}:$VERSION"
|
|
if [ "$REF_NAME" = "main" ]; then
|
|
docker tag "${PREFIX}-${svc}:$VERSION" "${PREFIX}-${svc}:latest"
|
|
docker push "${PREFIX}-${svc}:latest"
|
|
else
|
|
docker tag "${PREFIX}-${svc}:$VERSION" "${PREFIX}-${svc}:dev"
|
|
docker tag "${PREFIX}-${svc}:$VERSION" "${PREFIX}-${svc}:${VERSION}-dev"
|
|
docker push "${PREFIX}-${svc}:dev"
|
|
docker push "${PREFIX}-${svc}:${VERSION}-dev"
|
|
fi
|
|
done
|
|
echo "Published ${PREFIX}-backend and ${PREFIX}-webui"
|