866d053ec2
Surfaced by the first real CI run on the self-hosted runner: - scripts/check-codegen.ps1: `git status --porcelain` returns $null on a clean tree, so `.Trim()` threw "cannot call a method on a null-valued expression" — i.e. Check 2 could never report success. Pipe through Out-String (null -> ''). - clients/rust/protos/mxaccess_worker.proto: genuinely stale — missing the canonical `max_frame_bytes` field. Refreshed from src/ZB.MOM.WW.MxGateway.Contracts/Protos (Check 3 drift guard, added in P1). - ci.yml java job: act cannot resolve the gradle/actions monorepo action (`unsupported object type` on the v4 tag); install Gradle 9.5.1 directly instead (matches the local build) since the repo has no gradle wrapper. Claude-Session: https://claude.ai/code/session_01DMXXvNuPekkkrTEyPNxEkW
140 lines
5.9 KiB
YAML
140 lines
5.9 KiB
YAML
# Continuous integration for mxaccessgw (Gitea Actions; origin is Gitea at gitea.dohertylan.com).
|
|
#
|
|
# Scope note: the x86 Worker (src/ZB.MOM.WW.MxGateway.Worker) and Worker.Tests target
|
|
# .NET Framework 4.8 / x86 and need MXAccess COM installed, so they build ONLY on a Windows host.
|
|
# They are out of scope for this Linux `portable` job — the `windows` job below (self-hosted windev
|
|
# runner) covers them, and live-MXAccess integration runs are scheduled-only so they never gate a push.
|
|
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
schedule:
|
|
# Nightly live-MXAccess smoke (windev). Push/PR runs skip the live-mxaccess job.
|
|
- cron: '0 6 * * *'
|
|
|
|
jobs:
|
|
portable:
|
|
# Any Linux runner: no MXAccess, no x86. Covers the NonWindows solution, gateway fake-worker
|
|
# tests, the codegen/descriptor freshness guards, and the clients that build on Linux.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.26'
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy, rustfmt
|
|
|
|
# protoc is pinned to 34.1 (see docs/ToolchainLinks.md) so the committed client descriptor
|
|
# regenerates reproducibly. The freshness check normalizes source_code_info, so it tolerates
|
|
# patch drift, but keep the CI toolchain on the pin.
|
|
- name: Install protoc 34.1
|
|
run: |
|
|
curl -sSL -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v34.1/protoc-34.1-linux-x86_64.zip
|
|
sudo unzip -o /tmp/protoc.zip -d /usr/local bin/protoc 'include/*'
|
|
protoc --version
|
|
|
|
- name: Build NonWindows solution
|
|
run: dotnet build src/ZB.MOM.WW.MxGateway.NonWindows.slnx -c Release
|
|
|
|
# GitHub-hosted runners ship pwsh; the self-hosted act image does not. Install it as a
|
|
# .NET global tool (the SDK is already set up above) so the codegen check's `shell: pwsh` works.
|
|
- name: Install PowerShell (pwsh)
|
|
run: |
|
|
dotnet tool install --global PowerShell
|
|
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
|
|
|
|
# IPC-01 / IPC-19 / IPC-20: descriptor set + Contracts/Generated must match the current protos.
|
|
- name: Codegen / descriptor freshness
|
|
shell: pwsh
|
|
run: ./scripts/check-codegen.ps1
|
|
|
|
- name: Gateway fake-worker tests
|
|
run: dotnet test src/ZB.MOM.WW.MxGateway.Tests/ZB.MOM.WW.MxGateway.Tests.csproj -c Release --no-build
|
|
|
|
- name: .NET client
|
|
run: dotnet build clients/dotnet/ZB.MOM.WW.MxGateway.Client.slnx -c Release
|
|
|
|
- name: Go client
|
|
working-directory: clients/go
|
|
run: |
|
|
test -z "$(gofmt -l .)" || (gofmt -l . && echo 'gofmt needed' && exit 1)
|
|
go build ./...
|
|
go test ./...
|
|
|
|
- name: Rust client
|
|
working-directory: clients/rust
|
|
run: |
|
|
cargo fmt --all -- --check
|
|
cargo test --workspace
|
|
cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
- name: Python client
|
|
working-directory: clients/python
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install -e ".[dev]"
|
|
python -m pytest
|
|
|
|
java:
|
|
# Java client runs on a JDK-17 Linux runner (the macOS dev box has no JRE). The protobuf gradle
|
|
# plugin rewrites MxaccessGateway.java with spurious protobuf-runtime-version churn on every
|
|
# build; when no .proto changed, revert that one file so checkGeneratedClean / a dirty tree does
|
|
# not fail the build (repo memory project_java_generated_churn).
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '17'
|
|
# GitHub-hosted runners ship gradle on PATH; the self-hosted act image does not, and the repo
|
|
# has no gradle wrapper. act also can't resolve the gradle/actions monorepo action, so install
|
|
# gradle directly (pinned to 9.5.1, matching the local homebrew build in CLAUDE.md/memory).
|
|
- name: Install Gradle 9.5.1
|
|
run: |
|
|
curl -sSL "https://services.gradle.org/distributions/gradle-9.5.1-bin.zip" -o /tmp/gradle.zip
|
|
sudo unzip -q -d /opt/gradle /tmp/gradle.zip
|
|
echo "/opt/gradle/gradle-9.5.1/bin" >> "$GITHUB_PATH"
|
|
- name: Gradle test
|
|
working-directory: clients/java
|
|
run: gradle test
|
|
- name: Revert spurious protobuf-version churn (no .proto changed)
|
|
run: git checkout -- clients/java/src/main/generated/main/java/mxaccess_gateway/v1/MxaccessGateway.java || true
|
|
- name: Verify generated tree is clean
|
|
run: git diff --exit-code -- clients/java/src/main/generated
|
|
|
|
windows:
|
|
# Self-hosted windev runner (10.100.0.48): the only host that can build the x86 / net48 Worker
|
|
# and MXAccess-adjacent code. Not required for a green portable build; runs where a runner exists.
|
|
runs-on: [self-hosted, windows]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build x86 Worker
|
|
run: dotnet build src/ZB.MOM.WW.MxGateway.Worker/ZB.MOM.WW.MxGateway.Worker.csproj -p:Platform=x86
|
|
- name: Worker tests
|
|
run: dotnet test src/ZB.MOM.WW.MxGateway.Worker.Tests/ZB.MOM.WW.MxGateway.Worker.Tests.csproj -p:Platform=x86
|
|
|
|
live-mxaccess:
|
|
# Opt-in, scheduled only — needs installed MXAccess COM + live provider state. Never gates a push.
|
|
if: ${{ github.event_name == 'schedule' }}
|
|
runs-on: [self-hosted, windows, mxaccess]
|
|
env:
|
|
MXGATEWAY_RUN_LIVE_MXACCESS_TESTS: '1'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Live MXAccess smoke
|
|
run: dotnet test src/ZB.MOM.WW.MxGateway.IntegrationTests/ZB.MOM.WW.MxGateway.IntegrationTests.csproj --filter FullyQualifiedName~WorkerLiveMxAccessSmokeTests
|