|
| 1 | +name: Rust CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: rust-ci-${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + CARGO_TERM_COLOR: always |
| 17 | + CARGO_TARGET_DIR: target |
| 18 | + RUSTFLAGS: -D warnings |
| 19 | + |
| 20 | +jobs: |
| 21 | + quality: |
| 22 | + name: quality |
| 23 | + runs-on: ubuntu-24.04 |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 27 | + |
| 28 | + - name: Install Rust toolchain |
| 29 | + uses: dtolnay/rust-toolchain@1.97.0 |
| 30 | + with: |
| 31 | + components: clippy,rustfmt |
| 32 | + |
| 33 | + - name: Restore Rust cache |
| 34 | + uses: Swatinem/rust-cache@v2.9.1 |
| 35 | + |
| 36 | + - name: Check formatting |
| 37 | + run: cargo fmt --all --check |
| 38 | + |
| 39 | + - name: Run Clippy |
| 40 | + run: cargo clippy --all-targets --locked -- -D warnings |
| 41 | + |
| 42 | + - name: Run full test suite |
| 43 | + run: cargo test --all-targets --locked |
| 44 | + |
| 45 | + - name: Verify standalone lazy runtime state |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + cargo build --locked --bin cf-integration |
| 49 | + sandbox=$(mktemp -d) |
| 50 | + binary="$GITHUB_WORKSPACE/target/debug/cf-integration" |
| 51 | + if (cd "$sandbox" && CF_INTEGRATION_DIR="$sandbox/state" "$binary" conformance report); then |
| 52 | + echo "report unexpectedly succeeded without prior results" >&2 |
| 53 | + exit 1 |
| 54 | + fi |
| 55 | + test ! -e "$sandbox/state" |
| 56 | + if (cd "$sandbox" && CF_INTEGRATION_DIR="$sandbox/state" "$binary" stack config --topology dataplane); then |
| 57 | + echo "stack config unexpectedly succeeded outside a checkout" >&2 |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + test -f "$sandbox/state/secrets.env" |
| 61 | + find "$sandbox/state/assets" \ |
| 62 | + -path '*/docker/docker-compose.cf-integration.yaml' \ |
| 63 | + -type f -print -quit | grep -q . |
| 64 | +
|
| 65 | + - name: Verify published package |
| 66 | + run: cargo package --locked |
| 67 | + |
| 68 | + - name: Validate GitHub Actions workflows |
| 69 | + run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 |
| 70 | + |
| 71 | + native: |
| 72 | + name: native (${{ matrix.target }}) |
| 73 | + strategy: |
| 74 | + fail-fast: false |
| 75 | + matrix: |
| 76 | + include: |
| 77 | + - runner: ubuntu-24.04 |
| 78 | + target: x86_64-unknown-linux-gnu |
| 79 | + - runner: macos-15 |
| 80 | + target: aarch64-apple-darwin |
| 81 | + - runner: windows-2025 |
| 82 | + target: x86_64-pc-windows-msvc |
| 83 | + runs-on: ${{ matrix.runner }} |
| 84 | + steps: |
| 85 | + - name: Checkout repository |
| 86 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 87 | + |
| 88 | + - name: Install Rust toolchain |
| 89 | + uses: dtolnay/rust-toolchain@1.97.0 |
| 90 | + with: |
| 91 | + targets: ${{ matrix.target }} |
| 92 | + |
| 93 | + - name: Restore Rust cache |
| 94 | + uses: Swatinem/rust-cache@v2.9.1 |
| 95 | + |
| 96 | + - name: Run native tests |
| 97 | + shell: bash |
| 98 | + run: cargo test --all-targets --locked |
0 commit comments