Each time a PR is updated with a commit, CI recompiles Zebra from sratch for each set of tests, which is ~ 15 times. In some tests, the compilation takes longer than the test itself. CI should cache the compilation results and recompile only what's necessary, not only between image preparation and tests but also between individual preparations. We have the latter implemented: https://github.com/zcashfoundation/zebra/blob/49741e8b476aff1d1dd2f6a2f57ec9d24404d345/docker/Dockerfile#L97-L126, but it doesn't work. CI should also cache downloaded crates instead of pulling them for each compilation.
The solution should cache:
- Downloaded crates between image preparations.
- Compiled crates between image preparations.
- Compiled crates between image preparation and tests.
Ideally, CI should compile Zebra only once per commit for the tests Docker target: https://github.com/zcashfoundation/zebra/blob/882aa038c32e1018959f2617f9258cfdd5e16089/.github/workflows/ci-tests.yml#L130, without recompiling unmodified crates and redownloading all deps.
Each time a PR is updated with a commit, CI recompiles Zebra from sratch for each set of tests, which is ~ 15 times. In some tests, the compilation takes longer than the test itself. CI should cache the compilation results and recompile only what's necessary, not only between image preparation and tests but also between individual preparations. We have the latter implemented: https://github.com/zcashfoundation/zebra/blob/49741e8b476aff1d1dd2f6a2f57ec9d24404d345/docker/Dockerfile#L97-L126, but it doesn't work. CI should also cache downloaded crates instead of pulling them for each compilation.
The solution should cache:
Ideally, CI should compile Zebra only once per commit for the
testsDocker target: https://github.com/zcashfoundation/zebra/blob/882aa038c32e1018959f2617f9258cfdd5e16089/.github/workflows/ci-tests.yml#L130, without recompiling unmodified crates and redownloading all deps.