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

--profile fails to find custom profile #1648

Open
jmg-duarte opened this issue Nov 20, 2024 · 2 comments
Open

--profile fails to find custom profile #1648

jmg-duarte opened this issue Nov 20, 2024 · 2 comments
Assignees

Comments

@jmg-duarte
Copy link

jmg-duarte commented Nov 20, 2024

I'm running the following command:

 cargo tarpaulin --profile ci --locked --workspace

And I get the following warning:

warning: [email protected]: Unknown cargo profile `ci`. Defaulted to `Release` for the runtime build.

However, my Cargo.toml has:

[profile.ci]
inherits = "dev" # required otherwise we get the "unknown profile" error

codegen-units = 256     # Increase parallel code generation units
debug = false           # No debug information
incremental = false     # Disable incremental compilation for consistent CI performance
lto = "off"             # Disable Link Time Optimization
opt-level = 0           # No optimization
overflow-checks = false # Disable overflow checks
panic = 'abort'         # Use abort on panic to reduce binary size

Furthermore, if I run the following command I don't get any issues:

cargo b --profile ci

It might be that the --profile flag is for LLVM profiles, but if that is the case, the docs/help needs to be updated to match that, as it stands it's unclear.

@xd009642
Copy link
Owner

I tried to recreate this and it works as expected. I just did cargo new profile_tester and filled in the following Cargo.toml

[package]
name = "profile_tester"
version = "0.1.0"
edition = "2021"

[dependencies]


[profile.ci]
inherits = "dev" # required otherwise we get the "unknown profile" error

codegen-units = 256     # Increase parallel code generation units
debug = false           # No debug information
incremental = false     # Disable incremental compilation for consistent CI performance
lto = "off"             # Disable Link Time Optimization
opt-level = 0           # No optimization
overflow-checks = false # Disable overflow checks
panic = 'abort'        # Use abort on panic to reduce binary size

And then:

$ cargo tarpaulin --profile ci
2024-11-28T16:09:14.625559Z  INFO cargo_tarpaulin::config: Creating config
2024-11-28T16:09:14.638770Z  INFO cargo_tarpaulin: Running Tarpaulin
2024-11-28T16:09:14.638805Z  INFO cargo_tarpaulin: Building project
2024-11-28T16:09:14.638845Z  INFO cargo_tarpaulin::cargo: Cleaning project
   Compiling profile_tester v0.1.0 (/home/daniel/personal/meta/profile_tester)
    Finished `ci` profile [unoptimized] target(s) in 0.27s
Ok(CompilerArtifact(Artifact { package_id: PackageId { repr: "path+file:///home/daniel/personal/meta/profile_tester#0.1.0" }, manifest_path: "/home/daniel/personal/meta/profile_tester/Cargo.toml", target: Target { name: "profile_tester", kind: [Bin], crate_types: [Bin], required_features: [], src_path: "/home/daniel/personal/meta/profile_tester/src/main.rs", edition: E2021, doctest: false, test: true, doc: true }, profile: ArtifactProfile { opt_level: "0", debuginfo: None, debug_assertions: true, overflow_checks: false, test: true }, features: [], filenames: ["/home/daniel/personal/meta/profile_tester/target/ci/deps/profile_tester-1a16e5696443b180"], executable: Some("/home/daniel/personal/meta/profile_tester/target/ci/deps/profile_tester-1a16e5696443b180"), fresh: false }))
Ok(BuildFinished(BuildFinished { success: true }))
2024-11-28T16:09:14.970939Z  INFO cargo_tarpaulin::process_handling::linux: Launching test
2024-11-28T16:09:14.970971Z  INFO cargo_tarpaulin::process_handling: running /home/daniel/personal/meta/profile_tester/target/ci/deps/profile_tester-1a16e5696443b180

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

2024-11-28T16:09:15.644155Z  INFO cargo_tarpaulin::report: Coverage Results:
|| Uncovered Lines:
|| src/main.rs: 2
|| Tested/Total Lines:
|| src/main.rs: 1/2 +0.00%
|| 
50.00% coverage, 1/2 lines covered, +0.00% change in coverage

It might be somehow related to it being a workspace crate so if you can provide a bit more details to recreate this I can look deeper into it.

@jmg-duarte
Copy link
Author

This repo exhibits the same symptoms, your help is appreciated 🥹🫶
https://github.com/eigerco/polka-storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants