Skip to content

Commit 2775e39

Browse files
committed
chore: use toolchain to setup cargo nextest
1 parent 13cad8b commit 2775e39

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ jobs:
4343
- name: Setup Rust Toolchain
4444
uses: actions-rust-lang/setup-rust-toolchain@v1
4545
with:
46-
toolchain: stable
47-
- name: Install nextest
48-
run: cargo install cargo-nextest --locked
49-
- name: Cache Rust dependencies
50-
uses: Swatinem/rust-cache@v2
51-
with:
52-
cache-all-crates: 'true'
46+
components: nextest
5347
- name: Cargo Nextest
5448
run: cargo nextest run --all-features --workspace
5549
lint:

crates/gh-workflow-tailcall/src/standard.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,10 @@ impl StandardWorkflow {
202202
/// Creates the "Build and Test" job for the workflow.
203203
fn test_job(&self) -> Job {
204204
self.init_job("Build and Test")
205-
.add_step(Toolchain::default().add_stable())
206-
.add_step_when(
207-
matches!(self.test_runner, TestRunner::Nextest),
208-
Cargo::new("install")
209-
.args("cargo-nextest --locked")
210-
.name("Install nextest"),
211-
)
212-
.add_step(
213-
Step::uses("Swatinem", "rust-cache", "v2")
214-
.name("Cache Rust dependencies")
215-
.add_with(("cache-all-crates", "true")),
216-
)
205+
.add_step(match self.test_runner {
206+
TestRunner::Cargo => Toolchain::default(),
207+
TestRunner::Nextest => Toolchain::default().add_nextest(),
208+
})
217209
.add_step(match self.test_runner {
218210
TestRunner::Cargo => Cargo::new("test")
219211
.args("--all-features --workspace")

crates/gh-workflow/src/toolchain.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub enum Component {
3535
Clippy,
3636
Rustfmt,
3737
RustDoc,
38+
Nextest,
3839
}
3940

4041
impl Display for Component {
@@ -43,6 +44,7 @@ impl Display for Component {
4344
Component::Clippy => "clippy",
4445
Component::Rustfmt => "rustfmt",
4546
Component::RustDoc => "rust-doc",
47+
Component::Nextest => "nextest",
4648
};
4749
write!(f, "{val}")
4850
}
@@ -172,6 +174,11 @@ impl Toolchain {
172174
self
173175
}
174176

177+
pub fn add_nextest(mut self) -> Self {
178+
self.components.push(Component::Nextest);
179+
self
180+
}
181+
175182
pub fn add_nightly(mut self) -> Self {
176183
self.toolchain.push(Version::Nightly);
177184
self

0 commit comments

Comments
 (0)