name: CI on: push: branches: [main] pull_request: branches: [main] permissions: contents: read env: CARGO_TERM_COLOR: always jobs: rust: name: Rust checks runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - name: Cache cargo uses: actions/cache@v5 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Format run: cargo fmt -- --check - name: Clippy run: cargo clippy -- -D warnings - name: Test run: cargo test --verbose - name: CLI smoke test run: cargo run -- --help nix: name: Nix flake runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 - name: Install Nix uses: DeterminateSystems/nix-installer-action@v22 - name: Check flake run: nix flake check --print-build-logs - name: Build package run: nix build .#default --print-build-logs build: name: Build (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout uses: actions/checkout@v6 - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Cache cargo uses: actions/cache@v5 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-build-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Fetch dependencies shell: bash run: | for attempt in 1 2 3; do cargo fetch && exit 0 echo "cargo fetch failed on attempt ${attempt}; retrying..." sleep $((attempt * 10)) done cargo fetch - name: Build release binary run: cargo build --release