Files
Commonwealth-Online-Server/.github/workflows/csharp-server.yml
T

71 lines
2.3 KiB
YAML

name: CSharp Server Gate
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-test:
name: Repository policy, C# build and test
runs-on: [self-hosted, Linux, X64, co-server]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- name: Enforce repository runtime policy
run: bash server/scripts/verify-no-legacy-runtime.sh
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9
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
deploy-runner-fleet:
name: One-shot runner fleet deployment
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[deploy-runner-fleet]')
runs-on: [self-hosted, Linux, X64, co-server]
concurrency:
group: one-shot-runner-fleet-deployment
cancel-in-progress: false
timeout-minutes: 30
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- name: Deploy scheduler and runner fleet
shell: bash
run: bash .github/ops/deploy-runner-fleet.sh