Skip to content

Commit 2d42fc8

Browse files
committed
fix: Add rust-toolchain.toml for Cargo.lock v4 compatibility
1 parent 14d09f2 commit 2d42fc8

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,28 @@ jobs:
3030
strategy:
3131
matrix:
3232
os: [ubuntu-latest, windows-latest, macos-latest]
33-
rust: [1.86.0, stable, beta]
34-
include:
35-
# Add MSRV (Minimum Supported Rust Version) check on Ubuntu
36-
# Cargo.lock version 4 requires Rust 1.77.0 or later
37-
- os: ubuntu-latest
38-
rust: 1.77.0 # MSRV that supports Cargo.lock version 4
33+
# Using rust-toolchain.toml to enforce consistent Rust 1.86.0 across all environments
34+
# This ensures Cargo.lock v4 compatibility everywhere
3935

4036
steps:
4137
# Step 1: Check out the source code from the repository
4238
- name: Checkout source code
4339
uses: actions/checkout@v4
4440

45-
# Step 2: Install the specified Rust toolchain
46-
# This ensures we're testing with the exact Rust version from our matrix
41+
# Step 2: Install Rust toolchain from rust-toolchain.toml
42+
# This ensures consistent Rust 1.86.0 that supports Cargo.lock v4
4743
- name: Install Rust toolchain
48-
uses: dtolnay/rust-toolchain@master
44+
uses: dtolnay/rust-toolchain@1.86.0
4945
with:
50-
toolchain: ${{ matrix.rust }}
5146
components: rustfmt, clippy
5247

5348
# Step 3: Configure Rust cargo caching to speed up builds
5449
# This caches dependencies and build artifacts between runs
5550
- name: Setup Rust cache
5651
uses: Swatinem/rust-cache@v2
5752
with:
58-
# Cache key includes OS and Rust version for proper isolation
59-
key: ${{ matrix.os }}-${{ matrix.rust }}
53+
# Cache key includes OS for proper isolation
54+
key: ${{ matrix.os }}-rust-1.86.0
6055

6156
# Step 4: Build all targets to ensure compilation succeeds
6257
# We build all binary examples defined in Cargo.toml

rust-toolchain.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[toolchain]
2+
# Specify the Rust version that supports Cargo.lock version 4
3+
# This ensures consistency across local development, CI, and deployment
4+
channel = "1.86.0"
5+
6+
# Components needed for development and CI
7+
components = ["rustfmt", "clippy"]
8+
9+
# Profile for faster installs in CI
10+
profile = "minimal"

0 commit comments

Comments
 (0)