Open jennydaman opened 1 month ago
Oh, that's a good question. I didn't actually notice this in the rust-cache docs! I've been using it the wrong way, I guess. See https://github.com/houseabsolute/ubi/blob/master/.github/workflows/ci.yml for an example.
It seems to be caching something. My guess is that it's using the rust version installed on the Actions image. I think the only way to fix this is to have actions-rust-cross integrate rust-cache. That's not very hard to do, so I'll look into that soon.
I think the only way to fix this is to have actions-rust-cross integrate rust-cache. That's not very hard to do, so I'll look into that soon.
That would be great! Supporting rust-cache would give houseabsolute/actions-rust-cross a feature over https://github.com/taiki-e/setup-cross-toolchain-action
So I looked into this a little more. I think that Swatinem/rust-cache
is just not compatible with cross
. The rust-cache
action uses the output of rustc -vV
as part of its cache key. But if the build is running via cross
, then the output of rustc
on the host isn't relevant to the compilation artifacts.
I'm not sure how to fix this. The "obvious" solution would be to tell rust-cache
to run cross -vV
instead. But that doesn't actually do anything useful, since it will just run cargo
under the hood. What we really need is a way to ask cross
to give us the same output for a given target, but cross
only accepts a --target
parameter when given a subcommand like build
or test
.
I tried capturing the output from the correct rustc
with a simple crate using a build.rs
script, but even then, it shows me info about an x86-64 host.
So I'm a bit stumped on this one. If there was a way to get the right rustc
info from cross I think making a PR for rust-cache
to use this info wouldn't be too hard. But I don't know how to get this info.
Hi, I am wondering how to use this properly with
Swatinem/rust-cache
. The README sayshttps://github.com/houseabsolute/actions-rust-cross/blob/ad283b2fc65ad1f3a04fb8bf8b2b829aad4a9318/README.md?plain=1#L89-L93
However,
Swatinem/rust-cache
README sayshttps://github.com/Swatinem/rust-cache/blob/9bdad043e88c75890e36ad3bbc8d27f0090dd609/README.md?plain=1#L11-L12
I see that
houseabsolute/actions-rust-cross
callsdtolnay/rust-toolchain@master
, which is a wrapper aroundrustup
https://github.com/houseabsolute/actions-rust-cross/blob/d788e00f158ff5102cc3d4707b24be96c264a5bc/action.yml#L43-L46
So if you have something like
What ends up happening is
rustup
gets executed beforeSwatinem/rust-cache