diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57d7e592..0448b3e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 559965ab..02c83600 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 ############################################################################### diff --git a/engage.toml b/engage.toml index 7413a8e3..e2428aea 100644 --- a/engage.toml +++ b/engage.toml @@ -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 """ diff --git a/flake.nix b/flake.nix index e480fd82..9d9b103c 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/nix/pkgs/complement/default.nix b/nix/pkgs/complement/default.nix index 0100dbb6..5ebe9eb3 100644 --- a/nix/pkgs/complement/default.nix +++ b/nix/pkgs/complement/default.nix @@ -14,7 +14,7 @@ let main' = main.override { - profile = "dev"; + profile = "test"; all_features = true; disable_release_max_log_level = true; disable_features = [ diff --git a/nix/pkgs/main/default.nix b/nix/pkgs/main/default.nix index 5f21176e..72d67465 100644 --- a/nix/pkgs/main/default.nix +++ b/nix/pkgs/main/default.nix @@ -153,7 +153,7 @@ commonAttrs = { ]; }; - dontStrip = profile == "dev"; + dontStrip = profile == "dev" || profile == "test"; buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';