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

Skip install if cargo binaries recovered from cache on CI #402

Closed
RReverser opened this issue Oct 10, 2023 · 12 comments
Closed

Skip install if cargo binaries recovered from cache on CI #402

RReverser opened this issue Oct 10, 2023 · 12 comments
Assignees

Comments

@RReverser
Copy link
Member

See https://github.com/clockworklabs/SpacetimeDB/actions/runs/6472740872/job/17573981627 - when critcmp is recovered from Github cache, cargo install fails because it's already installed.

@kazimuth
Copy link
Contributor

@RReverser
Copy link
Member Author

Oddly, in other cases it works fine.

It probably has to do whether cache was picked up or not? (e.g. if it expired)

@kazimuth
Copy link
Contributor

The run I linked says Ignored package critcmp v0.1.8 is already installed, use --force to override which makes me think it's there? It's the same toolchain version and machine too :(

@RReverser
Copy link
Member Author

Ah no I see what you mean. It was recovered in that case.

Ah I think I know what it is - probably there is a newer version of critcmp now and then I think Cargo considers it a conflict?

@RReverser
Copy link
Member Author

Hm no there is no 0.1.9; super weird...

@RReverser
Copy link
Member Author

Some useful info in comments here https://www.reddit.com/r/learnrust/comments/lexewr/the_difference_in_behaviour_when_running_cargo/

My guess: an installed binary does not necessarily contain the metadata about the crate, which means that cargo needs to store versions of installed crates separately. I can see ~/.cargo/.crates.toml and ~/.cargo/.crates2.json on my machine which seem to contain this info. Maybe you are not caching these? The error also makes sense - cargo tried to install it (because it did not know that it was already installed), but failed to overwrite the executable which already exists there.

@RReverser
Copy link
Member Author

Still not sure why it would work sometimes then, but looks like we don't cache that file indeed:

path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/

@RReverser
Copy link
Member Author

More generally, it might be better to switch to the dedicated rust-cache action used by other projects: https://github.com/Swatinem/rust-cache

I believe it would be more tested / reliable than whatever custom config we come up with.

@kazimuth
Copy link
Contributor

Yeah. I'm tempted to just modify benchmarks.yml today and then switch to that in the future.

@kazimuth
Copy link
Contributor

Also we're throwing out critcmp in #357 which should help

@RReverser
Copy link
Member Author

Yeah I'd be happy with whatever temporary fix too; for now I just want to run it on my branches / PRs, but can't due to the error above.

@RReverser
Copy link
Member Author

I think this was fixed.

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