Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a basic rust-toolchain.toml #176

Merged
merged 4 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 22 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,10 @@ jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
Expand All @@ -32,46 +24,57 @@ jobs:
name: Package
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
toolchain:
- rust-toolchain.toml
- nightly
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: actions-rs/cargo@v1
if: matrix.toolchain == 'rust-toolchain.toml'
with:
toolchain: ${{ matrix.rust }}
override: true
command: package
- run: rustup install ${{ matrix.toolchain }}
if: matrix.toolchain != 'rust-toolchain.toml'
- uses: actions-rs/cargo@v1
if: matrix.toolchain != 'rust-toolchain.toml'
with:
command: package
toolchain: ${{ matrix.toolchain }}

test-versions:
name: Test Suite
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
toolchain:
- rust-toolchain.toml
- nightly
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: actions-rs/cargo@v1
if: matrix.toolchain == 'rust-toolchain.toml'
with:
toolchain: ${{ matrix.rust }}
override: true
command: test
- run: rustup install ${{ matrix.toolchain }}
if: matrix.toolchain != 'rust-toolchain.toml'
- uses: actions-rs/cargo@v1
if: matrix.toolchain != 'rust-toolchain.toml'
with:
command: test
toolchain: ${{ matrix.toolchain }}

test-os:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# "windows-latest" was removed; see https://github.com/ZcashFoundation/zcash_script/issues/38
os: [ubuntu-latest, macOS-latest, windows-latest]
Expand All @@ -85,19 +88,8 @@ jobs:
# - name: install LLVM on Mac
# if: matrix.os == 'macOS-latest'
# run: brew install llvm
- uses: actions-rs/toolchain@v1
- run: rustup target add x86_64-pc-windows-msvc
if: matrix.os == 'windows-latest'
with:
target: x86_64-pc-windows-msvc
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/toolchain@v1
if: matrix.os != 'windows-latest'
with:
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/cargo@v1
if: matrix.os == 'windows-latest'
with:
Expand All @@ -111,19 +103,10 @@ jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
Expand All @@ -132,19 +115,10 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
Expand Down
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ impl fmt::Display for Error {

impl std::error::Error for Error {}

// `bindgen::RustTarget::Stable_*` is deprecated in bindgen >= 0.71.0, but we are constrained
// downstream by the version supported by librocksdb-sys. However, one of our CI jobs still manages
// to pull a newer version, so this silences the deprecation on that job.
#[allow(deprecated)]
fn bindgen_headers() -> Result<()> {
println!("cargo:rerun-if-changed=depend/zcash/src/script/zcash_script.h");

Expand All @@ -31,6 +35,9 @@ fn bindgen_headers() -> Result<()> {
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
// This should not reference a version newer than rust-toolchain.toml. See
// rust-lang/rust-bindgen#3049 for a potential future solution.
.rust_target(bindgen::RustTarget::Stable_1_73)
// Finish the builder and generate the bindings.
.generate()
.map_err(|_| Error::GenerateBindings)?;
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
# TODO: C++ linking on Linux broke in 1.82, but is fixed again in 1.85. This can be bumped once that
# is released.
channel = "1.81"
Loading