ci/nix: use a `"test"` cargo profile

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-07-25 18:06:45 -04:00
parent 04971d0430
commit fb8a2846df
6 changed files with 40 additions and 5 deletions

View File

@ -62,6 +62,8 @@ jobs:
tests:
name: Test
runs-on: ubuntu-latest
env:
CARGO_PROFILE: "test"
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main

View File

@ -657,7 +657,16 @@ opt-level = 'z'
# '-Clink-arg=-Wl,-z,nodelete',
#]
# primarily used for CI
[profile.test]
inherits = "dev"
codegen-units = 16
incremental = false
[profile.test.package.'*']
inherits = "dev"
debug = 0
codegen-units = 16
incremental = false
###############################################################################

View File

@ -73,7 +73,9 @@ script = "cargo audit -D warnings -D unmaintained -D unsound -D yanked"
[[task]]
name = "cargo-fmt"
group = "lints"
script = "cargo fmt --check -- --color=always"
script = """
cargo fmt --check -- --color=always
"""
[[task]]
name = "cargo-doc"
@ -84,6 +86,7 @@ env DIRENV_DEVSHELL=all-features \
direnv exec . \
cargo doc \
--workspace \
--profile test \
--all-features \
--no-deps \
--document-private-items \
@ -96,6 +99,7 @@ group = "lints"
script = """
cargo clippy \
--workspace \
--profile test \
--all-targets \
--color=always \
-- \
@ -110,6 +114,7 @@ env DIRENV_DEVSHELL=all-features \
direnv exec . \
cargo clippy \
--workspace \
--profile test \
--all-targets \
--all-features \
--color=always \
@ -123,6 +128,7 @@ group = "lints"
script = """
cargo clippy \
--workspace \
--profile test \
--features jemalloc \
--all-targets \
--color=always \
@ -161,6 +167,7 @@ env DIRENV_DEVSHELL=all-features \
direnv exec . \
cargo test \
--workspace \
--profile test \
--all-targets \
--all-features \
--color=always \
@ -174,6 +181,7 @@ group = "tests"
script = """
cargo test \
--workspace \
--profile test \
--all-targets \
--color=always \
-- \
@ -190,9 +198,11 @@ name = "nix-default"
group = "tests"
script = """
env DIRENV_DEVSHELL=dynamic \
CARGO_PROFILE="test" \
direnv exec . \
bin/nix-build-and-cache just .#default
bin/nix-build-and-cache just .#default-test
env DIRENV_DEVSHELL=dynamic \
CARGO_PROFILE="test" \
direnv exec . \
nix run -L .#default -- --help
nix run -L .#default-test -- --help && nix run -L .#default-test -- --version
"""

View File

@ -154,6 +154,10 @@
# debug build users expect full logs
disable_release_max_log_level = true;
};
default-test = scopeHost.main.override {
profile = "test";
disable_release_max_log_level = true;
};
all-features = scopeHost.main.override {
all_features = true;
disable_features = [
@ -247,6 +251,16 @@
};
}
# An output for a statically-linked unstripped debug binary with the
# "test" profile (for CI usage only)
{
name = "${binaryName}-test";
value = scopeCrossStatic.main.override {
profile = "test";
disable_release_max_log_level = true;
};
}
# An output for a statically-linked binary with `--all-features`
{
name = "${binaryName}-all-features";

View File

@ -14,7 +14,7 @@
let
main' = main.override {
profile = "dev";
profile = "test";
all_features = true;
disable_release_max_log_level = true;
disable_features = [

View File

@ -153,7 +153,7 @@ commonAttrs = {
];
};
dontStrip = profile == "dev";
dontStrip = profile == "dev" || profile == "test";
buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';