name: ci on: pull_request: branches: - main push: branches: - main merge_group: branches: - main # A new commit on the same pull request cancels the run it replaces. concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.sha }} cancel-in-progress: true permissions: contents: read env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 RUSTFLAGS: -D warnings jobs: lint: name: ๐Ÿ”  Format and lint runs-on: ubuntu-24.04 timeout-minutes: 20 steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false # rust-toolchain.toml names the channel and components. - name: ๐Ÿฆ€ Install the toolchain run: rustup toolchain install - uses: Swatinem/rust-cache@v2.9.3 with: save-if: ${{ github.ref == 'refs/heads/main' }} - name: ๐ŸŽจ rustfmt run: cargo fmt --all -- --check - name: ๐Ÿ”  clippy run: cargo clippy --workspace --all-targets --locked -- -D warnings - name: ๐Ÿ“š rustdoc run: cargo doc --workspace --no-deps --locked env: RUSTDOCFLAGS: -D warnings msrv: name: ๐Ÿฆ• Minimum Rust version runs-on: ubuntu-24.04 timeout-minutes: 20 steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false # The version lives once, as `rust-version` in the root Cargo.toml. # RUSTUP_TOOLCHAIN overrides rust-toolchain.toml for every later step. - name: ๐Ÿฆ€ Install the minimum toolchain run: | msrv="$(sed -n 's/^rust-version = "\(.*\)"$/\1/p' Cargo.toml)" if [ -z "$msrv" ]; then echo "::error file=Cargo.toml::no rust-version found" exit 1 fi rustup toolchain install "$msrv" --profile minimal echo "RUSTUP_TOOLCHAIN=$msrv" >> "$GITHUB_ENV" - uses: Swatinem/rust-cache@v2.9.3 with: save-if: ${{ github.ref == 'refs/heads/main' }} - name: ๐Ÿฆ• cargo check run: cargo check --workspace --all-targets --locked test: name: ๐Ÿงช Tests (${{ matrix.os }}) runs-on: ${{ matrix.os }} timeout-minutes: 40 strategy: fail-fast: false matrix: os: - ubuntu-24.04 - macos-15 - windows-2025 steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: ๐Ÿฆ€ Install the toolchain run: rustup toolchain install - uses: Swatinem/rust-cache@v2.9.3 with: save-if: ${{ github.ref == 'refs/heads/main' }} - name: ๐Ÿงช cargo test run: cargo test --workspace --locked env: # A snapshot that differs is a failure here, never a new file. INSTA_UPDATE: "no" riscv64: name: ๐Ÿงฌ RISC-V (static riscv64 musl) runs-on: ubuntu-24.04 timeout-minutes: 40 steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: ๐Ÿฆ€ Install the toolchain run: | rustup toolchain install rustup target add riscv64gc-unknown-linux-musl - uses: Swatinem/rust-cache@v2.9.3 with: key: riscv64 save-if: ${{ github.ref == 'refs/heads/main' }} # Zig is the C cross compiler for ring and aws-lc; checked by hash. - name: โšก Install Zig and cargo-zigbuild env: ZIG_VERSION: 0.17.1 ZIG_SHA256: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a run: | curl -fsSLo zig.tar.xz "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" echo "${ZIG_SHA256} zig.tar.xz" | sha256sum -c - mkdir -p "$HOME/zig" tar -xJf zig.tar.xz -C "$HOME/zig" --strip-components=1 rm zig.tar.xz echo "$HOME/zig" >> "$GITHUB_PATH" cargo install --locked cargo-zigbuild@0.24.1 - name: ๐Ÿงช Install qemu-user run: | sudo apt-get update sudo apt-get install -y --no-install-recommends qemu-user-static - name: ๐Ÿงฌ Build and smoke-test run: scripts/riscv64.sh env: QEMU: qemu-riscv64-static REQUIRE_QEMU: "1" - uses: actions/upload-artifact@v7.0.2 with: name: libbui-riscv64gc-unknown-linux-musl path: target/riscv64gc-unknown-linux-musl/release/libbui if-no-files-found: error