Skip to content

Commit 6ad323b

Browse files
authored
test: Run tests faster with nextest
test: Run tests faster with `nextest`
2 parents 2c1f5fe + b0d51fd commit 6ad323b

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

.github/workflows/appservice.yml

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ jobs:
3939
- name: Load cache
4040
uses: Swatinem/rust-cache@v1
4141

42+
- name: Install nextest
43+
uses: taiki-e/install-action@nextest
44+
4245
- name: Run checks
4346
uses: actions-rs/cargo@v1
4447
with:

.github/workflows/ci.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848
- name: Load cache
4949
uses: Swatinem/rust-cache@v1
5050

51+
- name: Install nextest
52+
uses: taiki-e/install-action@nextest
53+
5154
- name: Test
5255
uses: actions-rs/cargo@v1
5356
with:
@@ -73,7 +76,10 @@ jobs:
7376
- name: Load cache
7477
uses: Swatinem/rust-cache@v1
7578

76-
- name: Clippy
79+
- name: Install nextest
80+
uses: taiki-e/install-action@nextest
81+
82+
- name: Test
7783
uses: actions-rs/cargo@v1
7884
with:
7985
command: run
@@ -115,10 +121,20 @@ jobs:
115121
- name: Load cache
116122
uses: Swatinem/rust-cache@v1
117123

124+
- name: Install nextest
125+
uses: taiki-e/install-action@nextest
126+
118127
- name: Test
128+
uses: actions-rs/cargo@v1
129+
with:
130+
command: nextest
131+
args: run
132+
133+
- name: Test documentation
119134
uses: actions-rs/cargo@v1
120135
with:
121136
command: test
137+
args: --doc
122138

123139
test-crypto-nodejs:
124140
name: linux / crypto node.js (${{ matrix.node-version }})

.github/workflows/wasm.yml

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ jobs:
6161
- name: Load cache
6262
uses: Swatinem/rust-cache@v1
6363

64+
- name: Install nextest
65+
uses: taiki-e/install-action@nextest
66+
6467
- name: Rust Check
6568
uses: actions-rs/cargo@v1
6669
with:

xtask/src/ci.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ enum CiCommand {
2222
Clippy,
2323
/// Check documentation
2424
Docs,
25-
/// Run default tests
26-
Test,
2725
/// Run tests with a specific feature set
2826
TestFeatures {
2927
#[clap(subcommand)]
@@ -84,7 +82,6 @@ impl CiArgs {
8482
CiCommand::Typos => check_typos(),
8583
CiCommand::Clippy => check_clippy(),
8684
CiCommand::Docs => check_docs(),
87-
CiCommand::Test => run_tests(),
8885
CiCommand::TestFeatures { cmd } => run_feature_tests(cmd),
8986
CiCommand::TestAppservice => run_appservice_tests(),
9087
CiCommand::Wasm { cmd } => run_wasm_checks(cmd),
@@ -96,7 +93,6 @@ impl CiArgs {
9693
check_clippy()?;
9794
check_typos()?;
9895
check_docs()?;
99-
run_tests()?;
10096
run_feature_tests(None)?;
10197
run_appservice_tests()?;
10298
run_wasm_checks(None)?;
@@ -141,12 +137,6 @@ fn check_docs() -> Result<()> {
141137
build_docs([], DenyWarnings::Yes)
142138
}
143139

144-
fn run_tests() -> Result<()> {
145-
cmd!("rustup run stable cargo test").run()?;
146-
cmd!("rustup run beta cargo test").run()?;
147-
Ok(())
148-
}
149-
150140
fn run_feature_tests(cmd: Option<FeatureSet>) -> Result<()> {
151141
let args = BTreeMap::from([
152142
(FeatureSet::NoEncryption, "--no-default-features --features sled,native-tls"),
@@ -164,7 +154,12 @@ fn run_feature_tests(cmd: Option<FeatureSet>) -> Result<()> {
164154
]);
165155

166156
let run = |arg_set: &str| {
167-
cmd!("rustup run stable cargo test -p matrix-sdk").args(arg_set.split_whitespace()).run()
157+
cmd!("rustup run stable cargo nextest run -p matrix-sdk")
158+
.args(arg_set.split_whitespace())
159+
.run()?;
160+
cmd!("rustup run stable cargo test --doc -p matrix-sdk")
161+
.args(arg_set.split_whitespace())
162+
.run()
168163
};
169164

170165
match cmd {
@@ -186,15 +181,17 @@ fn run_crypto_tests() -> Result<()> {
186181
"rustup run stable cargo clippy -p matrix-sdk-crypto --features=backups_v1 -- -D warnings"
187182
)
188183
.run()?;
189-
cmd!("rustup run stable cargo test -p matrix-sdk-crypto --features=backups_v1").run()?;
190-
cmd!("rustup run stable cargo test -p matrix-sdk-crypto-ffi").run()?;
184+
cmd!("rustup run stable cargo nextest run -p matrix-sdk-crypto --features=backups_v1").run()?;
185+
cmd!("rustup run stable cargo test --doc -p matrix-sdk-crypto --features=backups_v1").run()?;
186+
cmd!("rustup run stable cargo nextest run -p matrix-sdk-crypto-ffi").run()?;
191187

192188
Ok(())
193189
}
194190

195191
fn run_appservice_tests() -> Result<()> {
196192
cmd!("rustup run stable cargo clippy -p matrix-sdk-appservice -- -D warnings").run()?;
197-
cmd!("rustup run stable cargo test -p matrix-sdk-appservice").run()?;
193+
cmd!("rustup run stable cargo nextest run -p matrix-sdk-appservice").run()?;
194+
cmd!("rustup run stable cargo test --doc -p matrix-sdk-appservice").run()?;
198195

199196
Ok(())
200197
}

0 commit comments

Comments
 (0)