I setup a CI pipeline:
version: 2.1
commands:
restore_cache_cmd:
steps:
- restore_cache:
key: cache_cmd-v1-{{ arch }}-{{ checksum "Cargo.lock" }}
save_cache_cmd:
steps:
- save_cache:
key: cache_cmd-v1-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
jobs:
# Precompile all the rust dependencies
compile:
# Has all the build tools installed, clean env otherwise
executor: nix-executor
steps:
- restore_cache_cmd
- run:
name: Compile App
command: |
cargo test --all --no-run
cargo zigbuild --target x86_64-unknown-linux-musl --bin server --release
- save_cache_cmd
I expect that if I run this step first as root for the rest it will save time, but I still get a lot of time compiling after it. I see in the logs the cache is restored.
Testing in my machine works (insofar i don’t have the same env as CI).