Clear docker cache after building in CI

We're at the CI storage limits, so hopefully this helps.
This commit is contained in:
Luke Parker 2023-07-25 21:09:36 -04:00
parent 61d46dccd4
commit 4949793c3f
No known key found for this signature in database
4 changed files with 20 additions and 6 deletions

View file

@ -33,4 +33,4 @@ jobs:
github-token: ${{ inputs.github-token }}
- name: Run message-queue Docker tests
run: cd tests/message-queue && cargo test
run: cd tests/message-queue && GITHUB_CI=true cargo test

View file

@ -28,7 +28,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Unit Tests Without Features
run: cargo test --package monero-serai --lib
run: GITHUB_CI=true cargo test --package monero-serai --lib
# Doesn't run unit tests with features as the tests workflow will
@ -51,11 +51,11 @@ jobs:
- name: Run Integration Tests Without Features
# Runs with the binaries feature so the binaries build
# https://github.com/rust-lang/cargo/issues/8396
run: cargo test --package monero-serai --features binaries --test '*'
run: GITHUB_CI=true cargo test --package monero-serai --features binaries --test '*'
- name: Run Integration Tests
# Don't run if the the tests workflow also will
if: ${{ matrix.version != 'v0.18.2.0' }}
run: |
cargo test --package monero-serai --all-features --test '*'
cargo test --package serai-processor --all-features monero
GITHUB_CI=true cargo test --package monero-serai --all-features --test '*'
GITHUB_CI=true cargo test --package serai-processor --all-features monero

View file

@ -37,4 +37,4 @@ jobs:
github-token: ${{ inputs.github-token }}
- name: Run processor Docker tests
run: cd tests/processor && cargo test
run: cd tests/processor && GITHUB_CI=true cargo test

View file

@ -143,6 +143,20 @@ pub fn build(name: String) {
println!("Built!");
if std::env::var("GITHUB_CI").is_ok() {
println!("In CI, so clearing cache to prevent hitting the storage limits.");
Command::new("docker")
.arg("builder")
.arg("prune")
.arg("--all")
.arg("--force")
.output()
.unwrap();
if !res.status.success() {
println!("failed to clear cache after building {name}\n");
}
}
// Set built
built_lock.insert(name, true);
}