CultLib/.github/workflows/cultnet-interop.yml
Meta Vens 95493862bd Split the Python runtime into cultcache-py, cultnet-py, cultmesh-py
One distribution named cultcache-py carried three libraries. Rust and
TypeScript layer them as cultcache < cultnet < cultmesh; Python now does
the same, one package per layer, module names unchanged so every
`from cultmesh_py import ...` keeps working.

Two imports ran against that layering and are resolved by moving code to
where the dependency direction says it lives, not by adding a shim:

- cultnet_py.interop_peer imported the Verse/peer catalog, authority
  lease, stream, and simulation-fact contracts from cultmesh_py. They are
  wire contracts a bare peer has to speak without owning a node, which is
  why cultnet-rs and cultnet-ts keep them in the net layer. They now live
  in cultnet_py.cultmesh_contracts; cultmesh_py re-exports them.
- cultcache_py.benchmark imported cultnet_py. It measures framed CultNet
  parse beside cache paths, so it and compare_csharp move to cultnet_py.
  verify checks all three packages and moves to cultmesh_py.

The single 6,693-line test module is split by what each test touches: a
test using any cultmesh_py name lands in cultmesh-py, else cultnet_py in
cultnet-py, else cultcache-py. Each suite runs with only its layer and the
layers below on the path, so a test that reaches up fails to import
rather than quietly binding the packages back together. 11 / 53 / 78 =
the same 142.

Workflows install all three; the publish job is one matrix over the
three packages keyed by tag prefix. The TS test harnesses put all three
src directories on PYTHONPATH. cultcache-py bumps to 0.2.0 because it no
longer contains cultnet_py or cultmesh_py; the new packages start at
0.1.0. Nothing was ever published, so no PyPI consumer moves.

  cultcache-py  11 tests, path: cultcache-py/src
  cultnet-py    53 tests, path: + cultnet-py/src
  cultmesh-py   78 tests, path: + cultmesh-py/src
  python -m cultmesh_py.verify -> ok, all five checks
  cultnet_py.interop_peer imports with cultmesh_py absent

Not run here: the cultnet-ts interop ring and cultcache-ts store matrix
need dotnet/kotlin peers; their PYTHONPATH change is four lines.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 13:10:47 +02:00

123 lines
4.5 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
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: 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 packages/cultcache-py/tests/test_cultcache.py
- 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