diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 5c7eb17..1fe36c4 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -9,18 +9,25 @@ on: permissions: contents: read +# Cancel superseded runs on the same PR/branch; never cancel runs on main. +concurrency: + group: pr-checks-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 jobs: - fmt-clippy-test: - name: fmt + clippy + test + fmt-clippy: + name: fmt + clippy runs-on: ubuntu-latest - + timeout-minutes: 30 steps: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Set up Rust toolchain uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable @@ -37,5 +44,119 @@ jobs: - name: cargo clippy run: cargo clippy --workspace --all-targets -- -D warnings + test: + name: test (${{ matrix.toolchain }}) + runs-on: ubuntu-latest + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + toolchain: [stable, beta] + # Beta is informational: an upstream beta regression should warn, not block merges. + continue-on-error: ${{ matrix.toolchain == 'beta' }} + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Set up Rust toolchain + uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable + with: + toolchain: ${{ matrix.toolchain }} + + - name: Cache cargo + uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 + with: + key: ${{ matrix.toolchain }} + - name: cargo test run: cargo test --workspace + + build-release: + name: build --release + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Set up Rust toolchain + uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable + with: + toolchain: stable + + - name: Cache cargo + uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 + with: + key: release + + - name: cargo build --release + run: cargo build --release --workspace + + audit: + name: cargo audit + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Set up Rust toolchain + uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable + with: + toolchain: stable + + - name: Cache cargo + uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 + with: + key: audit + + - name: Install cargo-audit + run: cargo install --locked cargo-audit + + - name: cargo audit + run: cargo audit + + msrv: + name: MSRV (Rust 1.91) + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Set up Rust 1.91 + uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # 1.91 + with: + toolchain: "1.91" + + - name: Cache cargo + uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 + with: + key: msrv + + - name: cargo check on MSRV + run: cargo check --workspace --all-targets + + docker-build: + name: Docker build smoke test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Build image + run: docker build -t gitlawb-node:ci-test . + + - name: Smoke test --version + run: docker run --rm gitlawb-node:ci-test --version diff --git a/Cargo.toml b/Cargo.toml index a91deea..d7da0c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ [workspace.package] version = "0.3.9" edition = "2021" +rust-version = "1.91" license = "MIT OR Apache-2.0" authors = ["gitlawb contributors"] repository = "https://github.com/gitlawb/node" diff --git a/crates/git-remote-gitlawb/Cargo.toml b/crates/git-remote-gitlawb/Cargo.toml index c3275b5..2fba611 100644 --- a/crates/git-remote-gitlawb/Cargo.toml +++ b/crates/git-remote-gitlawb/Cargo.toml @@ -3,6 +3,7 @@ name = "git-remote-gitlawb" description = "Git remote helper — enables 'git clone gitlawb://did:gitlawb:...'" version.workspace = true edition.workspace = true +rust-version.workspace = true license.workspace = true [[bin]] diff --git a/crates/gitlawb-attest/Cargo.toml b/crates/gitlawb-attest/Cargo.toml index 6b9b656..a2b7c77 100644 --- a/crates/gitlawb-attest/Cargo.toml +++ b/crates/gitlawb-attest/Cargo.toml @@ -3,6 +3,7 @@ name = "gitlawb-attest" description = "External Attestation v1: pluggable provenance attachments for gitlawb ref-update certs" version.workspace = true edition.workspace = true +rust-version.workspace = true license.workspace = true [dependencies] diff --git a/crates/gitlawb-core/Cargo.toml b/crates/gitlawb-core/Cargo.toml index 486a5aa..1fd11a0 100644 --- a/crates/gitlawb-core/Cargo.toml +++ b/crates/gitlawb-core/Cargo.toml @@ -3,6 +3,7 @@ name = "gitlawb-core" description = "Core cryptographic primitives for the gitlawb network: DIDs, CIDs, UCAN, HTTP Signatures, ref-update certificates" version.workspace = true edition.workspace = true +rust-version.workspace = true license.workspace = true [dependencies] diff --git a/crates/gitlawb-node/Cargo.toml b/crates/gitlawb-node/Cargo.toml index 5f10ec9..72c4a76 100644 --- a/crates/gitlawb-node/Cargo.toml +++ b/crates/gitlawb-node/Cargo.toml @@ -3,6 +3,7 @@ name = "gitlawb-node" description = "The gitlawb node daemon — git hosting over HTTP with DID auth" version.workspace = true edition.workspace = true +rust-version.workspace = true license.workspace = true [[bin]] diff --git a/crates/gl/Cargo.toml b/crates/gl/Cargo.toml index bae6bdf..cff5107 100644 --- a/crates/gl/Cargo.toml +++ b/crates/gl/Cargo.toml @@ -3,6 +3,7 @@ name = "gl" description = "The gitlawb CLI — identity management, node control, MCP server" version.workspace = true edition.workspace = true +rust-version.workspace = true license.workspace = true [[bin]]