Skip to content

Commit 95e583f

Browse files
authored
Improve Ci cache (#16709)
* Add rust CI cache * comment save if for now * Add cache to depscache * Unify the containers * linux-build-lib to use its own cache * rollback datafusion-cli for now (blocked by #16644) * Fix CLI comment * Load cache for `linux-datafusion-common-features` * Setup more caches * Cache for clippy * comment clippy save * Remove caches that aren't working * Save if * Save if
1 parent 2e08d5c commit 95e583f

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

.github/actions/setup-macos-aarch64-builder/action.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ runs:
4545
rustup component add rustfmt
4646
- name: Setup rust cache
4747
uses: Swatinem/rust-cache@v2
48+
with:
49+
save-if: ${{ github.ref_name == 'main' }}
4850
- name: Configure rust runtime env
4951
uses: ./.github/actions/setup-rust-runtime

.github/workflows/rust.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
uses: ./.github/actions/setup-builder
5252
with:
5353
rust-version: stable
54+
- name: Rust Dependency Cache
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
shared-key: "amd-ci-check" # this job uses it's own cache becase check has a separate cache and we need it to be fast as it blocks other jobs
58+
save-if: ${{ github.ref_name == 'main' }}
5459
- name: Prepare cargo build
5560
run: |
5661
# Adding `--locked` here to assert that the `Cargo.lock` file is up to
@@ -99,6 +104,11 @@ jobs:
99104
uses: ./.github/actions/setup-builder
100105
with:
101106
rust-version: stable
107+
- name: Rust Dependency Cache
108+
uses: Swatinem/rust-cache@v2
109+
with:
110+
save-if: false # set in linux-test
111+
shared-key: "amd-ci"
102112
- name: Check datafusion-substrait (default features)
103113
run: cargo check --profile ci --all-targets -p datafusion-substrait
104114
#
@@ -162,6 +172,11 @@ jobs:
162172
uses: ./.github/actions/setup-builder
163173
with:
164174
rust-version: stable
175+
- name: Rust Dependency Cache
176+
uses: Swatinem/rust-cache@v2
177+
with:
178+
save-if: false # set in linux-test
179+
shared-key: "amd-ci"
165180
- name: Check datafusion (default features)
166181
run: cargo check --profile ci --all-targets -p datafusion
167182
#
@@ -247,15 +262,22 @@ jobs:
247262
name: cargo test (amd64)
248263
needs: linux-build-lib
249264
runs-on: ubuntu-latest
265+
container:
266+
image: amd64/rust
250267
steps:
251268
- uses: actions/checkout@v4
252269
with:
253270
submodules: true
254271
fetch-depth: 1
255272
- name: Setup Rust toolchain
256-
run: rustup toolchain install stable
257-
- name: Install Protobuf Compiler
258-
run: sudo apt-get install -y protobuf-compiler
273+
uses: ./.github/actions/setup-builder
274+
with:
275+
rust-version: stable
276+
- name: Rust Dependency Cache
277+
uses: Swatinem/rust-cache@v2
278+
with:
279+
save-if: ${{ github.ref_name == 'main' }}
280+
shared-key: "amd-ci"
259281
- name: Run tests (excluding doctests and datafusion-cli)
260282
env:
261283
RUST_BACKTRACE: 1
@@ -279,6 +301,10 @@ jobs:
279301
name: cargo test datafusion-cli (amd64)
280302
needs: linux-build-lib
281303
runs-on: ubuntu-latest
304+
# should be uncommented once https://github.com/apache/datafusion/pull/16644 is merged
305+
# and cache should be added
306+
# container:
307+
# image: amd64/rust
282308
steps:
283309
- uses: actions/checkout@v4
284310
with:
@@ -329,6 +355,11 @@ jobs:
329355
uses: ./.github/actions/setup-builder
330356
with:
331357
rust-version: stable
358+
- name: Rust Dependency Cache
359+
uses: Swatinem/rust-cache@v2
360+
with:
361+
save-if: ${{ github.ref_name == 'main' }}
362+
shared-key: "amd-ci-linux-test-example"
332363
- name: Run examples
333364
run: |
334365
# test datafusion-sql examples
@@ -655,6 +686,11 @@ jobs:
655686
rust-version: stable
656687
- name: Install Clippy
657688
run: rustup component add clippy
689+
- name: Rust Dependency Cache
690+
uses: Swatinem/rust-cache@v2
691+
with:
692+
save-if: ${{ github.ref_name == 'main' }}
693+
shared-key: "amd-ci-clippy"
658694
- name: Run clippy
659695
run: ci/scripts/rust_clippy.sh
660696

0 commit comments

Comments
 (0)