Files
Commonwealth-Online-Server/.github/workflows/csharp-server.yml
T
NomadsReach 9c4580daaf Install the pinned .NET SDK to a runner-writable dir on self-hosted CI
setup-dotnet defaulted to /usr/share/dotnet, which the runner user cannot
write to (Permission denied). Point DOTNET_INSTALL_DIR at runner.tool_cache
so the 8.0 SDK installs into a writable, cached location.
2026-08-16 17:43:16 -04:00

51 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]
# The self-hosted runner user cannot write to the system /usr/share/dotnet,
# so install the pinned SDK into a runner-writable (and cached) path instead.
env:
DOTNET_INSTALL_DIR: ${{ runner.tool_cache }}/dotnet
steps:
- uses: actions/checkout@v4
- name: Enforce repository runtime policy
run: bash server/scripts/verify-no-legacy-runtime.sh
- uses: actions/setup-dotnet@v4
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