65 lines
2.0 KiB
YAML
65 lines
2.0 KiB
YAML
name: CSharp Server Gate
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- rewrite/csharp-server
|
|
paths:
|
|
- "server/**"
|
|
- "src/ServerProcess.*"
|
|
- "CMakeLists.txt"
|
|
- "cmake/stage_server.cmake"
|
|
- "build.bat"
|
|
- "deploy.bat"
|
|
- "check-setup.bat"
|
|
- ".github/workflows/csharp-server.yml"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: [self-hosted, Linux, X64]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Reject Python files
|
|
shell: bash
|
|
run: |
|
|
if find . -type f -name '*.py' -print -quit | grep -q .; then
|
|
echo "Python files are not allowed in CO-SERVER"
|
|
find . -type f -name '*.py' -print
|
|
exit 1
|
|
fi
|
|
if find server -maxdepth 1 -type f -name 'requirements*.txt' -print -quit | grep -q .; then
|
|
echo "Python requirements files are not allowed in CO-SERVER"
|
|
find server -maxdepth 1 -type f -name 'requirements*.txt' -print
|
|
exit 1
|
|
fi
|
|
|
|
- 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 --no-restore
|
|
|
|
- name: Check Linux scripts
|
|
working-directory: server
|
|
run: |
|
|
chmod +x start.sh fix-port.sh scripts/linux_compat_checks.sh
|
|
bash -n start.sh
|
|
bash -n fix-port.sh
|
|
bash -n 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
|