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

ci: run doctests after cargo nextest #3183

Merged
merged 1 commit into from
Aug 9, 2022
Merged
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
ci: run doctests after cargo nextest
  • Loading branch information
neil2468 committed Aug 9, 2022
commit 619d59e8b39bc74a5282f25fdbfb5698457866bc
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