feat(rust): implement the config.toml dual-parser (Phase 2) #153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| env: | |
| __RCLONE_VERSION: v1.68.2 | |
| jobs: | |
| test: | |
| name: Go ${{ matrix.go }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| go: ["1.x"] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| cache: true | |
| - name: Cache rclone | |
| id: cache-rclone | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.local/bin/rclone | |
| key: rclone-${{ env.__RCLONE_VERSION }}-${{ runner.os }}-${{ runner.arch }} | |
| - name: Install rclone | |
| if: steps.cache-rclone.outputs.cache-hit != 'true' | |
| run: bash scripts/install-rclone.sh | |
| - name: Add rclone to PATH | |
| run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Format check | |
| run: test -z "$(gofmt -l .)" | |
| - name: Unit and integration tests | |
| run: go test ./... | |
| - name: Build | |
| run: go build ./cmd/git-sfs | |
| - name: Workflow suite | |
| run: bash test/workflows/run.sh | |
| - name: Differential harness self-check | |
| run: python3 test/differential/run.py --binary a=./git-sfs --binary b=./git-sfs | |
| - name: Lock protocol conformance | |
| run: python3 test/differential/lock_contention.py --binary v1=./git-sfs | |
| rust: | |
| name: Rust | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable, 2026-07-16 | |
| with: | |
| components: rustfmt, clippy | |
| - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | |
| - name: Format check | |
| run: cargo fmt --all -- --check | |
| - name: Clippy | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| - name: Unit tests | |
| run: cargo test --workspace | |
| - name: Build | |
| run: cargo build --workspace --release | |
| # rust-rewrite-plan 8: a dependency pulling in native-tls/OpenSSL breaks | |
| # static musl linking, and that would otherwise surface for the first time in | |
| # phase 6 -- the one phase with no test coverage, building the exact archives | |
| # contract-spec 11 requires. Proving the static link holds from phase 1 | |
| # onward turns a release-time surprise into an ordinary CI failure. | |
| rust-musl: | |
| name: Rust (musl static link) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable, 2026-07-16 | |
| with: | |
| targets: x86_64-unknown-linux-musl | |
| - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: cargo-musl-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | |
| - name: Install musl-tools | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| - name: Build statically linked binary | |
| run: cargo build --release --target x86_64-unknown-linux-musl -p git-sfs | |
| - name: Verify static linking | |
| run: | | |
| binary=target/x86_64-unknown-linux-musl/release/git-sfs | |
| file "$binary" | |
| if ! file "$binary" | grep -q 'statically linked'; then | |
| echo "::error::$binary is not statically linked" | |
| exit 1 | |
| fi |