anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
442 stars 54 forks source link

Cache RISC0 VM in the CI #2823

Open lukaszcz opened 2 weeks ago

lukaszcz commented 2 weeks ago

We need to figure out how to do that. A straightforward approach of caching the r0vm executable didn't work. RISC0 installation also modifies something in the Rust toolchain (which we install separately earlier).

lukaszcz commented 2 weeks ago

The actions-rust-lang/setup-rust-toolchain@v1 github action is not completely correct with our current setup, because it caches the Rust toolchain independently. We get an error if the Install Rust toolchain action completed, but Install RISC0 VM didn't fully complete. Then the Rust toolchain is cached without all the necessary modifications needed by RISC0. The CI then fails with the message that cargo doesn't have the command risczero.

I think my previous attempt at caching RISC0 VM was failing because of this issue. We could cache RISC0 VM, but just remove the cache manually every time we get this error. We have this problem anyway whether we cache RISC0 VM or not.

@paulcadman suggests: It's possible that we could automate the cache removal when that particular step (install RISC0 VM) fails. We already have something to clean caches for closed PRs, perhaps parts of it could be adapted: https://github.com/anoma/juvix/blob/main/.github/workflows/clean-up-cache.yaml

lukaszcz commented 2 weeks ago

@paulcadman: we should set cache-on-failure option to false on the setup-rust-toolchain action