Files
CommandForge/.gitea/workflows/build.yml
T
poli0981andClaude Opus 5.5 83286ed1c3 ci: build and test on Gitea Actions
Move build.yml to .gitea/workflows. The Windows jobs run in host mode on the
maintainer's PC, so setup-dotnet installs into the runner tool cache, the
NuGet cache is the PC's own (no actions/cache), and artifacts go through the
Gitea fork of upload-artifact (upstream v4+ refuses non-GitHub servers).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:06:37 +07:00

111 lines
3.9 KiB
YAML

name: Build
# Build, format check, tests and a packaging smoke test on every push to main and every pull
# request (Gitea Actions, ops runbook poli0981/.github docs/GITEA-MIGRATION.md).
#
# - `windows-latest` is HOST MODE on the maintainer's PC (PowerShell, no isolation): setup-dotnet
# installs into the runner tool cache (DOTNET_INSTALL_DIR), never into C:\Program Files. NuGet
# packages come from the PC's per-user cache, which outlives the job, so there is no actions/cache.
# - Upstream actions/upload-artifact v4+ refuses non-GitHub servers: the Gitea fork uploads.
# - Outsiders cannot open pull requests on Gitea (registration is off), so no run here comes from
# a stranger's fork.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
# WPF (net10.0-windows) only builds on Windows.
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Keep .NET SDK installs in the runner tool cache (host mode)
shell: pwsh
run: |
$base = if ($env:RUNNER_TOOL_CACHE) { $env:RUNNER_TOOL_CACHE } else { Join-Path $env:LOCALAPPDATA 'gitea-runner\toolcache' }
"DOTNET_INSTALL_DIR=$(Join-Path $base 'dotnet')" >> $env:GITHUB_ENV
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Restore (NuGet audit fails on moderate+ advisories)
run: dotnet restore CommandForge.slnx
- name: Verify formatting
run: dotnet format CommandForge.slnx --verify-no-changes --no-restore
- name: Build (Release, warnings = errors)
run: dotnet build CommandForge.slnx -c Release --no-restore
- name: Test
run: >-
dotnet test CommandForge.slnx -c Release --no-build
--logger "trx;LogFileName=test-results.trx"
--collect "XPlat Code Coverage"
--results-directory TestResults
- name: Upload test results
if: ${{ !cancelled() }}
uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
with:
name: test-results
path: TestResults
if-no-files-found: ignore
retention-days: 14
package:
# Publishes and packs exactly like release.yml, so a packaging regression (e.g. the Elevator
# missing from the publish folder) fails the pull request instead of the tagged release.
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Keep .NET SDK installs in the runner tool cache (host mode)
shell: pwsh
run: |
$base = if ($env:RUNNER_TOOL_CACHE) { $env:RUNNER_TOOL_CACHE } else { Join-Path $env:LOCALAPPDATA 'gitea-runner\toolcache' }
"DOTNET_INSTALL_DIR=$(Join-Path $base 'dotnet')" >> $env:GITHUB_ENV
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Publish + pack (Velopack smoke test)
shell: pwsh
run: ./scripts/pack.ps1 -Version 0.0.1
- name: Upload installer preview
uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
with:
name: installer-preview
path: Releases/*-Setup.exe
if-no-files-found: error
retention-days: 7