diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57d7e5921ddf48201e97998fa1fc3ec39520e307..0448b3e6ede5e5dcbe6da9ffaba846b0625ccc03 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 559965abb0239630445b1605adcdae4a804c0ae4..02c83600cb42c373db0a17853c65a453dc4980db 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 7413a8e3d5b20c8bcbc4ab24b0e456ff99c9a577..e2428aeafc83a61f62104e3a270a9f27293f58ee 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 e480fd821137f0a3139efe647ba8d92da6fc5427..9d9b103c383961caf2a8507d1d5338a1fa8de417 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 0100dbb6c391707577a3c7f251e2a00bf93d47e0..5ebe9eb34423632ec60321f472b1a46185a63d71 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 5f21176e33dba304dd9fc3d652ef1c233cc0ce26..72d6746505d6d437a014b26545615056d79d908c 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';