name: rust on: push: branches: [master, main] paths: ['rust/**', '.github/workflows/rust.yml'] pull_request: paths: ['rust/**', '.github/workflows/rust.yml'] defaults: run: shell: pwsh working-directory: rust jobs: build: name: build / test / clippy / fmt runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: toolchain: '1.85' components: rustfmt, clippy - name: Cache cargo uses: Swatinem/rust-cache@v2 with: workspaces: rust - name: cargo fmt --check run: cargo fmt --all -- --check - name: cargo build --workspace run: cargo build --workspace --all-targets - name: cargo test --workspace run: cargo test --workspace --no-fail-fast env: # MX_LIVE is intentionally NOT set — live tests require an AVEVA # install + Galaxy DB which CI cannot provide. See design/60-roadmap.md # validation strategy: live probes run on the maintainer's workstation, # gated by `MX_LIVE=1` via `tools/Setup-LiveProbeEnv.ps1`. MX_LIVE: '' - name: cargo clippy --workspace -- -D warnings run: cargo clippy --workspace --all-targets -- -D warnings public-api: name: cargo public-api drift check (F41) runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: dtolnay/rust-toolchain@nightly - name: Install cargo-public-api run: cargo install --locked cargo-public-api - name: Diff each crate's public API against the baseline shell: pwsh working-directory: rust run: | $crates = @( 'mxaccess-codec', 'mxaccess-rpc', 'mxaccess-asb-nettcp', 'mxaccess-asb', 'mxaccess-galaxy', 'mxaccess-callback', 'mxaccess-nmx', 'mxaccess', 'mxaccess-compat' ) $drift = $false foreach ($crate in $crates) { Write-Host "=== $crate ===" $live = cargo +nightly public-api --simplified -p $crate 2>$null $baseline = Get-Content "../design/public-api/$crate.txt" -Raw $liveJoined = ($live -join "`n") + "`n" if ($liveJoined -ne $baseline) { Write-Host "::error file=design/public-api/$crate.txt::public API drift detected for $crate" # Print a unified diff for the PR log. $tmpLive = New-TemporaryFile $tmpBaseline = New-TemporaryFile Set-Content -Path $tmpLive -Value $liveJoined -NoNewline Set-Content -Path $tmpBaseline -Value $baseline -NoNewline git diff --no-index --color=never -- $tmpBaseline $tmpLive $drift = $true } } if ($drift) { Write-Host "::error::Public API drift detected. Run 'cargo +nightly public-api --simplified -p ' locally and update design/public-api/.txt to match the intended new surface." exit 1 }