From a9ca95a3364b6efa69b2dc9af9975fdfe974eeb5 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Mon, 28 Sep 2026 00:44:15 +0200 Subject: [PATCH] ci: share a pinned Rust toolchain across all jobs --- .github/workflows/publish.yml | 7 ++++--- .github/workflows/sqlx.yml | 26 ++++++++++++++++++++++---- CONTRIBUTING.md | 7 +++++++ rust-toolchain.toml | 4 ++++ 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 270f269757..a484288f9d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,12 +5,14 @@ on: push: paths: - "**/Cargo.toml" + - "rust-toolchain.toml" - ".github/workflows/publish.yml" tags: - "v*" pull_request: paths: - "**/Cargo.toml" + - "rust-toolchain.toml" - ".github/workflows/publish.yml" permissions: @@ -21,9 +23,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 - with: - toolchain: stable + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 - name: Verify workspace packaging if: ${{ !startsWith(github.ref, 'refs/tags/v') }} diff --git a/.github/workflows/sqlx.yml b/.github/workflows/sqlx.yml index 5162d034b9..67e619a107 100644 --- a/.github/workflows/sqlx.yml +++ b/.github/workflows/sqlx.yml @@ -12,6 +12,8 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - run: cargo fmt --all -- --check check: @@ -22,10 +24,8 @@ jobs: tls: [native-tls, rustls] steps: - uses: actions/checkout@v6 - - name: Install pinned Clippy toolchain - uses: dtolnay/rust-toolchain@ce678459e9fc7500d337468f904b95f1b5c10b5e - with: - components: clippy + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: prefix-key: v1-sqlx @@ -58,6 +58,8 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: prefix-key: v1-sqlx @@ -90,6 +92,8 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: prefix-key: v1-sqlx @@ -113,6 +117,8 @@ jobs: needs: check steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - run: mkdir /tmp/sqlite3-lib && wget -O /tmp/sqlite3-lib/ipaddr.so https://github.com/nalgeon/sqlean/releases/download/0.15.2/ipaddr.so - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: @@ -143,6 +149,8 @@ jobs: needs: check steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: @@ -192,6 +200,8 @@ jobs: needs: check steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: prefix-key: v1-sqlx @@ -213,6 +223,8 @@ jobs: needs: check steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: @@ -255,6 +267,8 @@ jobs: needs: check steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: @@ -290,6 +304,8 @@ jobs: needs: check steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: @@ -322,6 +338,8 @@ jobs: timeout-minutes: 15 steps: - uses: actions/checkout@v6 + - name: Install pinned Rust toolchain + run: rustc --version --verbose - uses: Swatinem/rust-cache@65012b490220f477f20ab979e35ae732e6de4e68 with: prefix-key: v1-sqlx diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e99011fae7..154d857dd2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,13 @@ You can use this document to figure out how and where to start. - Include the database driver and version. - Include the database version. +## Rust toolchain + +Install Rust through [rustup](https://rustup.rs/). The checked-in +`rust-toolchain.toml` selects the same Rust, Clippy, and rustfmt versions locally +and in CI. Rustup installs that toolchain automatically when you run a Rust command +in this checkout. Update the version in a dedicated PR and run the full CI suite. + ## Making changes - Fork the repository on GitHub. diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000000..e63004962e --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.98.1" +profile = "minimal" +components = ["clippy", "rustfmt"]