diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-11-21 16:53:28 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-11-21 17:33:07 +0100 |
| commit | ba9cc102e295634035a3f9bac1b4656e735c5fc6 (patch) | |
| tree | d080028538cf75a9a18a562ef1e947179c828b22 | |
| parent | 32b59148a8c40f3c8d74510d26c7c36791f53580 (diff) | |
ci: cache lockfiles
- Removes the slow "updating crates.io index, updating git" at start of the job.
- Avoids CI being randomly slower if a widely-used dep (like serde) gets bumped causing rebuilding everything.
| -rwxr-xr-x | .github/ci/build-stable.sh | 10 | ||||
| -rwxr-xr-x | .github/ci/build.sh | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/.github/ci/build-stable.sh b/.github/ci/build-stable.sh index 8012f6923..ffaebeb35 100755 --- a/.github/ci/build-stable.sh +++ b/.github/ci/build-stable.sh | |||
| @@ -12,9 +12,19 @@ export CARGO_TARGET_DIR=/ci/cache/target | |||
| 12 | # used when pointing stm32-metapac to a CI-built one. | 12 | # used when pointing stm32-metapac to a CI-built one. |
| 13 | export CARGO_NET_GIT_FETCH_WITH_CLI=true | 13 | export CARGO_NET_GIT_FETCH_WITH_CLI=true |
| 14 | 14 | ||
| 15 | # Restore lockfiles | ||
| 16 | if [ -f /ci/cache/lockfiles.tar ]; then | ||
| 17 | echo Restoring lockfiles... | ||
| 18 | tar xf /ci/cache/lockfiles.tar | ||
| 19 | fi | ||
| 20 | |||
| 15 | hashtime restore /ci/cache/filetime.json || true | 21 | hashtime restore /ci/cache/filetime.json || true |
| 16 | hashtime save /ci/cache/filetime.json | 22 | hashtime save /ci/cache/filetime.json |
| 17 | 23 | ||
| 18 | sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml | 24 | sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml |
| 19 | 25 | ||
| 20 | ./ci_stable.sh | 26 | ./ci_stable.sh |
| 27 | |||
| 28 | # Save lockfiles | ||
| 29 | echo Saving lockfiles... | ||
| 30 | find . -type f -name Cargo.lock -exec tar -cf /ci/cache/lockfiles.tar '{}' \+ \ No newline at end of file | ||
diff --git a/.github/ci/build.sh b/.github/ci/build.sh index 78ab976df..e7a6c0d86 100755 --- a/.github/ci/build.sh +++ b/.github/ci/build.sh | |||
| @@ -18,7 +18,17 @@ fi | |||
| 18 | # used when pointing stm32-metapac to a CI-built one. | 18 | # used when pointing stm32-metapac to a CI-built one. |
| 19 | export CARGO_NET_GIT_FETCH_WITH_CLI=true | 19 | export CARGO_NET_GIT_FETCH_WITH_CLI=true |
| 20 | 20 | ||
| 21 | # Restore lockfiles | ||
| 22 | if [ -f /ci/cache/lockfiles.tar ]; then | ||
| 23 | echo Restoring lockfiles... | ||
| 24 | tar xf /ci/cache/lockfiles.tar | ||
| 25 | fi | ||
| 26 | |||
| 21 | hashtime restore /ci/cache/filetime.json || true | 27 | hashtime restore /ci/cache/filetime.json || true |
| 22 | hashtime save /ci/cache/filetime.json | 28 | hashtime save /ci/cache/filetime.json |
| 23 | 29 | ||
| 24 | ./ci.sh | 30 | ./ci.sh |
| 31 | |||
| 32 | # Save lockfiles | ||
| 33 | echo Saving lockfiles... | ||
| 34 | find . -type f -name Cargo.lock -exec tar -cf /ci/cache/lockfiles.tar '{}' \+ \ No newline at end of file | ||
