CultLib/.github/workflows/cultnet-interop.yml
Meta Vens 52abce9191 Interop workflow: every command in a step counts
The Windows runner's default pwsh does not stop when a native command fails, so
a multi-command step reported only its last command: a failing cultnet-py suite
went green inside "Verify Python RUDP reliability". The job now defaults to Git
Bash, which the runner starts with -e -o pipefail. The pwsh consolidation guard
checks git ls-files' exit code instead of treating a failed listing as clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 15:32:28 +02:00

163 lines
6.8 KiB
YAML

name: CultNet cross-runtime interop
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
interop:
name: C# / TypeScript / Rust / Python / Kotlin
runs-on: windows-latest
timeout-minutes: 60
# Windows runners default to pwsh, which does not stop when a native command fails: a
# multi-command step reported only its last command, and a failing cultnet-py suite
# went green that way. Git Bash runs as `bash -e -o pipefail`, so every command counts.
# Steps that name `shell: pwsh` check $LASTEXITCODE themselves.
defaults:
run:
shell: bash
env:
DOTNET: dotnet
CARGO: cargo
PYTHON: python
KOTLIN_VERSION: 2.2.21
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- name: Check out CultLib
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
- name: Install Kotlin compiler
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$version = $env:KOTLIN_VERSION
$zip = Join-Path $env:RUNNER_TEMP "kotlin-compiler-$version.zip"
$root = Join-Path $env:RUNNER_TEMP "kotlin"
Invoke-WebRequest "https://github.com/JetBrains/kotlin/releases/download/v$version/kotlin-compiler-$version.zip" -OutFile $zip
Expand-Archive -Path $zip -DestinationPath $root -Force
$kotlinHome = Join-Path $root "kotlinc"
if (-not (Test-Path (Join-Path $kotlinHome "bin\kotlinc.bat"))) {
throw "Kotlin compiler was not expanded to $kotlinHome"
}
"KOTLIN_HOME=$kotlinHome" | Out-File -FilePath $env:GITHUB_ENV -Append
"KOTLIN_JAVA_HOME=$env:JAVA_HOME" | Out-File -FilePath $env:GITHUB_ENV -Append
"$kotlinHome\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Verify CultNet schema contracts stayed consolidated
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
# packages/cultnet-rs/contracts/cultnet/ holds R-AB's vendored byte copies (the crate must build
# when copied alone). Their drift guard is packages/cultnet-rs/tests/schema_discovery_contracts.rs:74-99.
$tracked = git ls-files '*.schema.json'
if ($LASTEXITCODE -ne 0) { throw "git ls-files failed" }
$stray = $tracked | Where-Object { $_ -notmatch '^(packages/cultnet-rs/)?contracts/cultnet/' }
# -I skips binary files: unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.dll
# still embeds the retired namespace until it is rebuilt (REC-032 D4, deferred).
$oldNamespace = git grep -I -lE 'GameCult/cultnet-ts/(integration/)?contracts' -- ':!.voidbot'
if ($LASTEXITCODE -eq 2) {
throw "git grep failed"
}
if ($stray) {
Write-Host "Schema files found outside contracts/cultnet/:"
$stray | ForEach-Object { Write-Host " $_" }
}
if ($oldNamespace) {
Write-Host "Files still referencing the retired GameCult/cultnet-ts contracts namespace:"
$oldNamespace | ForEach-Object { Write-Host " $_" }
}
if ($stray -or $oldNamespace) {
throw "CultNet schema contracts drifted out of contracts/cultnet/ (REC-032). See CultLib/contracts/cultnet/ and rewrite any `$id back to https://github.com/GameCult/CultLib/contracts/cultnet/."
}
# git grep exits 1 when nothing matches, and the runner's pwsh wrapper
# ends the step with that $LASTEXITCODE; a clean tree must pass.
exit 0
- name: Install Node dependencies
run: npm install --no-package-lock
- name: Install Python package dependencies
run: python -m pip install -e packages/cultcache-py -e packages/cultnet-py -e packages/cultmesh-py
- name: Build TypeScript workspace dependencies
run: npm run build --workspace packages/cultcache-ts
- name: Build Kotlin interop peer
shell: pwsh
run: .\packages\cultmesh-kotlin\build.ps1
- name: Build CultNet TypeScript interop tests
run: |
npm run build --workspace packages/cultnet-ts
npx tsc -p packages/cultnet-ts/tsconfig.test.json --pretty false
- name: Verify TypeScript RUDP reliability
run: npm test --workspace packages/cultnet-ts
- name: Verify Python RUDP reliability
run: |
python -m unittest discover -s packages/cultcache-py/tests
python -m unittest discover -s packages/cultnet-py/tests
python -m unittest discover -s packages/cultmesh-py/tests
- name: Verify Rust RUDP reliability
run: cargo test --manifest-path packages/cultnet-rs/Cargo.toml rudp
- name: Verify Rust CultMesh runtime-local surface
run: cargo test --manifest-path packages/cultmesh-rs/Cargo.toml
- name: Verify C# RUDP reliability
run: dotnet test tests/GameCult.Networking.Tests/GameCult.Networking.Tests.csproj --filter "FullyQualifiedName~Rudp"
- name: Interop RUDP Python lane
timeout-minutes: 8
run: node --test --test-name-pattern "TypeScript and Python|Python and TypeScript" packages/cultnet-ts/dist-test/test/interop/cultnet-interop.test.js
- name: Interop RUDP Rust lane
timeout-minutes: 8
run: node --test --test-concurrency=1 --test-name-pattern "TypeScript and Rust|Rust and TypeScript" packages/cultnet-ts/dist-test/test/interop/cultnet-interop.test.js
- name: Interop RUDP C# lane
timeout-minutes: 8
run: node --test --test-name-pattern "TypeScript and C#|C# and TypeScript" packages/cultnet-ts/dist-test/test/interop/cultnet-interop.test.js
- name: Interop RUDP Kotlin lane
timeout-minutes: 8
run: node --test --test-name-pattern "TypeScript and Kotlin|Kotlin and TypeScript" packages/cultnet-ts/dist-test/test/interop/cultnet-interop.test.js
- name: Interop RUDP impairment matrix
timeout-minutes: 12
run: node --test --test-name-pattern "dropped|reordered|fragmented|disconnect|ping/pong" packages/cultnet-ts/dist-test/test/interop/cultnet-interop.test.js
- name: Interop schema-v0 discovery lane
timeout-minutes: 20
run: node --test --test-name-pattern "shared schema-v0 lane" packages/cultnet-ts/dist-test/test/interop/cultnet-interop.test.js