CI / Go (test / vet / build) (push) Successful in 1m22s
CI / Go (test / vet / build) (pull_request) Successful in 1m31s
CI / Rust (fmt / clippy / test / build) (pull_request) Successful in 2m18s
CI / Rust (fmt / clippy / test / build) (push) Successful in 2m47s
CI / Go ↔ Rust differential + SQLite takeover (pull_request) Successful in 1m49s
CI / Go ↔ Rust differential + SQLite takeover (push) Successful in 2m42s
Go 1.25 ServeMux redirects unclean paths with 301, while newer Go (and the Rust port that mirrors it) uses 307, so the Go reference built in CI disagreed with Rust on '/a/../app.js'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
131 lines
3.3 KiB
YAML
131 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master, develop]
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# Pin the toolchain to the declared MSRV so CI matches production.
|
|
RUST_TOOLCHAIN: 1.90.0
|
|
# The differential check compares Rust against net/http behaviour, which
|
|
# changes between Go releases (e.g. ServeMux redirects 301 -> 307), so the
|
|
# reference must be built with the same Go the Rust port mirrors.
|
|
GO_VERSION: "1.27.3"
|
|
|
|
jobs:
|
|
rust:
|
|
name: Rust (fmt / clippy / test / build)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: rustfmt, clippy
|
|
|
|
- name: Cache Cargo registry and build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Format check
|
|
run: cargo fmt --check
|
|
|
|
- name: Test
|
|
run: cargo test --locked
|
|
|
|
- name: Clippy
|
|
run: cargo clippy --locked --all-targets -- -D warnings
|
|
|
|
- name: Release build
|
|
run: cargo build --locked --release
|
|
|
|
- name: Upload release binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: balance-server-release
|
|
path: target/release/balance-server
|
|
if-no-files-found: error
|
|
|
|
go:
|
|
name: Go (test / vet / build)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Test
|
|
run: go test ./...
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Build
|
|
run: go build ./...
|
|
|
|
compatibility:
|
|
name: Go ↔ Rust differential + SQLite takeover
|
|
runs-on: ubuntu-latest
|
|
needs: [rust, go]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Install Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Cache Cargo registry and build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Build Rust (debug) and Go reference
|
|
run: |
|
|
cargo build --locked
|
|
go build -o target/integration/go-server ./cmd/balance-server
|
|
|
|
- name: Run differential compatibility scenarios
|
|
run: python3 tools/compatibility.py --rust-binary target/debug/balance-server
|