Files
Commonwealth-Online-Server/.github/workflows/csharp-server.yml
T
NomadsReach f1a7876770 Move DOTNET_INSTALL_DIR to step scope (runner context invalid at job env)
The job-level env used runner.tool_cache, which isn't available until a
runner is assigned, so the workflow failed to parse. Set it on the
setup-dotnet step, where the runner context is valid.
2026-08-16 17:46:35 -04:00

52 lines
1.7 KiB
YAML

name: CSharp Server Gate
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-and-test:
name: Repository policy, C# build and test
runs-on: [self-hosted, Linux, X64]
steps:
- uses: actions/checkout@v4
- name: Enforce repository runtime policy
run: bash server/scripts/verify-no-legacy-runtime.sh
- uses: actions/setup-dotnet@v4
# The runner user cannot write to system /usr/share/dotnet; install the
# pinned SDK into a runner-writable, cached path instead. runner.* context
# is only valid at step scope, not job-level env.
env:
DOTNET_INSTALL_DIR: ${{ runner.tool_cache }}/dotnet
with:
dotnet-version: "8.0.x"
- name: Build C# server
working-directory: server
run: dotnet build CommonwealthOnline.Server.csproj -c Release --nologo
- name: Run C# server tests
working-directory: server
run: dotnet run --project tests/CommonwealthOnline.Server.Tests.csproj -c Release
- name: Check Linux scripts
working-directory: server
run: |
chmod +x start.sh fix-port.sh scripts/linux_compat_checks.sh scripts/verify-no-legacy-runtime.sh
bash -n start.sh
bash -n fix-port.sh
bash -n scripts/linux_compat_checks.sh
bash -n scripts/verify-no-legacy-runtime.sh
bash scripts/linux_compat_checks.sh
- name: Publish Linux server
working-directory: server
run: dotnet publish CommonwealthOnline.Server.csproj -c Release -r linux-x64 --self-contained false -o publish/linux-x64 --nologo
- name: Verify published entrypoint
working-directory: server
run: test -f publish/linux-x64/CommonwealthOnline.Server.dll