Skip to content

Commit

Permalink
ci: run doctests after cargo nextest
Browse files Browse the repository at this point in the history
  • Loading branch information
neil2468 authored and mergify[bot] committed Aug 9, 2022
1 parent 2ea26c6 commit 53168bf
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions implementations/rust/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext {
// See...
// https://github.com/build-trust/ockam/issues/2822
// https://github.com/build-trust/ockam/issues/2342
environmentCI = { ->
environmentVars = { ->
env = [
RUSTFLAGS: "--cfg tokio_unstable -Cdebuginfo=0 -Dwarnings -C link-arg=-fuse-ld=/opt/mold/bin/mold",
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: "clang",
Expand All @@ -41,7 +41,7 @@ ext {
task lint_cargo_fmt_check {
doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('fmt', '--all', '--', '--check')
}
}
Expand All @@ -50,7 +50,7 @@ task lint_cargo_fmt_check {
task lint_cargo_clippy {
doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('clippy', '--no-deps', '--', '-D', 'warnings')
}
}
Expand All @@ -59,7 +59,7 @@ task lint_cargo_clippy {
task lint_cargo_deny {
doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('deny', '--all-features', '--manifest-path=../../Cargo.toml', 'check', 'licenses', 'advisories')
}
}
Expand All @@ -75,7 +75,7 @@ task lint {
task build_docs {
doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('doc', '--no-deps')
}
}
Expand All @@ -84,7 +84,7 @@ task build_docs {
task build {
doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('--locked', 'build')
}
}
Expand All @@ -93,7 +93,7 @@ task build {
task build_examples {
doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('--locked', 'build', '--examples')
}
}
Expand All @@ -104,13 +104,24 @@ task test {
description 'Test the project.'

doLast {
exec {
environment environmentCI()

if (ci) {
// Use cargo nextest in CI
if (ci) {
// Use 'cargo nextest' in CI
exec {
environment environmentVars()
commandLine cargo('--locked', 'nextest', 'run')
} else {
}
// Nextest does not currently support doctests,
// so run doctests using cargo
// See https://github.com/nextest-rs/nextest/issues/16
exec {
environment environmentVars()
commandLine cargo('--locked', 'test', '--doc')
}
}
else {
// Use 'cargo test' when not in CI
exec {
environment environmentVars()
commandLine cargo('--locked', 'test')
}
}
Expand All @@ -123,7 +134,7 @@ task clean {

doLast {
exec {
environment environmentCI()
environment environmentVars()
commandLine cargo('clean')
}
}
Expand Down

0 comments on commit 53168bf

Please sign in to comment.