-
Notifications
You must be signed in to change notification settings - Fork 0
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
cargo-chef
seems to build the API twice
#155
Comments
The issue won't disappear as easily because of our binary still depending on |
Seems like LukeMathWalker/cargo-chef#273. |
prose_pod_api
lib in main.rs
cargo-chef
seems to build the API twice
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In 6ad0bed, I introduced
cargo-chef
to speed Docker builds up. It works by computing if dependencies have changed and leverages Docker's cache to avoid rebuilding them if they haven't changed (i.e. if theCargo.lock
andCargo.toml
files haven't changed, to simplify).Because of how smoke tests are defined, we have to expose all of the API's code through a library, and have smoke tests use it. Because we have such a library, I decided to have
main.rs
depend on it, exactly as smoke tests do. However, looking at GitHub Actions logs, I spottedin the
RUN cargo chef cook --profile="dev" --recipe-path recipe.json
Docker layerand
in
RUN cargo install --path crates/rest-api --bin prose-pod-api --profile="dev"
.The binary is version
0.7.0
, so0.0.1
must definitely be the library being compiled. This meanscargo-chef
detects the whole API code (exceptmain.rs
) as a dependency! That's why every GitHub release build, even in debug mode, would take exactly 40 minutes, no matter if we changed the dependencies or not.Even worse, it looks like some dependencies are computed twice 😰 See how much time it takes to build the library and the binary:
The text was updated successfully, but these errors were encountered: