Skip to content

Commit dac5c6a

Browse files
committed
feat: use nightly rust with cranelift for fast dev builds
1 parent c067bd8 commit dac5c6a

5 files changed

Lines changed: 33 additions & 12 deletions

File tree

.cargo/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
rustflags = ["-Z", "threads=8"]
3+
4+
[unstable]
5+
codegen-backend = true

.github/workflows/ci-rust.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI - Rust
33
on:
44
push:
55
paths:
6+
- .cargo/**
67
- Cargo.toml
78
- Cargo.lock
89
- crates/cli/**
@@ -16,14 +17,19 @@ jobs:
1617
- name: Checkout repository
1718
uses: actions/checkout@v6
1819

20+
- name: Install Rust nightly with Cranelift
21+
uses: dtolnay/rust-toolchain@nightly
22+
with:
23+
components: rustc-codegen-cranelift-preview
24+
1925
- name: Cache Cargo dependencies
2026
uses: Swatinem/rust-cache@v2
2127

2228
- name: Install cargo-llvm-cov
2329
uses: taiki-e/install-action@cargo-llvm-cov
2430

2531
- name: Generate code coverage
26-
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
32+
run: CARGO_PROFILE_DEV_CODEGEN_BACKEND=llvm cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
2733

2834
- name: Upload coverage to Codecov
2935
if: github.actor != 'dependabot[bot]'
@@ -39,6 +45,11 @@ jobs:
3945
- name: Checkout repository
4046
uses: actions/checkout@v6
4147

48+
- name: Install Rust nightly with Cranelift
49+
uses: dtolnay/rust-toolchain@nightly
50+
with:
51+
components: rustfmt, clippy, rustc-codegen-cranelift-preview
52+
4253
- name: Cache Cargo dependencies
4354
uses: Swatinem/rust-cache@v2
4455

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ publish = false
2020
[patch.crates-io]
2121
num-bigint-dig = { git = "https://github.com/dignifiedquire/num-bigint", rev = "1eb690d9" }
2222

23+
[profile.dev]
24+
codegen-backend = "cranelift"
25+
2326
# The profile that 'dist' will build with
2427
[profile.dist]
2528
inherits = "release"

flake.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
overlays = [
2828
rust-overlay.overlays.default
2929
(final: prev: {
30-
rustToolchain = final.rust-bin.stable.latest.default;
30+
rustToolchain = final.rust-bin.nightly.latest.default.override {
31+
extensions = [ "rustc-codegen-cranelift-preview" ];
32+
};
3133
})
3234
];
3335

0 commit comments

Comments
 (0)