Skip to content

Commit de15917

Browse files
authored
Improve cache usage in CI (#7678)
* Improve cache usage in CI * Trigger GA to check the effect of improvement
1 parent 6ed2e84 commit de15917

File tree

1 file changed

+20
-57
lines changed

1 file changed

+20
-57
lines changed

.github/workflows/rust.yml

Lines changed: 20 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,24 @@ jobs:
4747
image: amd64/rust
4848
steps:
4949
- uses: actions/checkout@v4
50-
- name: Cache Cargo
51-
uses: actions/cache@v3
52-
with:
53-
# these represent dependencies downloaded by cargo
54-
# and thus do not depend on the OS, arch nor rust version.
55-
path: /github/home/.cargo
56-
key: cargo-cache-
5750
- name: Setup Rust toolchain
5851
uses: ./.github/actions/setup-builder
5952
with:
6053
rust-version: stable
6154

55+
- name: Cache Cargo
56+
uses: actions/cache@v3
57+
with:
58+
path: |
59+
~/.cargo/bin/
60+
~/.cargo/registry/index/
61+
~/.cargo/registry/cache/
62+
~/.cargo/git/db/
63+
./target/
64+
./datafusion-cli/target/
65+
# this key equals the ones on `linux-build-lib` for re-use
66+
key: cargo-cache-benchmark-${{ hashFiles('datafusion/**/Cargo.toml', 'benchmarks/Cargo.toml', 'datafusion-cli/Cargo.toml') }}
67+
6268
- name: Check workspace without default features
6369
run: cargo check --no-default-features -p datafusion
6470

@@ -84,12 +90,6 @@ jobs:
8490
- uses: actions/checkout@v4
8591
with:
8692
submodules: true
87-
- name: Cache Cargo
88-
uses: actions/cache@v3
89-
with:
90-
path: /github/home/.cargo
91-
# this key equals the ones on `linux-build-lib` for re-use
92-
key: cargo-cache-
9393
- name: Setup Rust toolchain
9494
uses: ./.github/actions/setup-builder
9595
with:
@@ -109,12 +109,6 @@ jobs:
109109
- uses: actions/checkout@v4
110110
with:
111111
submodules: true
112-
- name: Cache Cargo
113-
uses: actions/cache@v3
114-
with:
115-
path: /github/home/.cargo
116-
# this key equals the ones on `linux-build-lib` for re-use
117-
key: cargo-cache-
118112
- name: Setup Rust toolchain
119113
uses: ./.github/actions/setup-builder
120114
with:
@@ -211,12 +205,6 @@ jobs:
211205
image: amd64/rust
212206
steps:
213207
- uses: actions/checkout@v4
214-
- name: Cache Cargo
215-
uses: actions/cache@v3
216-
with:
217-
path: /github/home/.cargo
218-
# this key equals the ones on `linux-build-lib` for re-use
219-
key: cargo-cache-
220208
- name: Setup Rust toolchain
221209
uses: ./.github/actions/setup-builder
222210
with:
@@ -241,9 +229,14 @@ jobs:
241229
- name: Cache Cargo
242230
uses: actions/cache@v3
243231
with:
244-
path: /github/home/.cargo
232+
path: |
233+
~/.cargo/bin/
234+
~/.cargo/registry/index/
235+
~/.cargo/registry/cache/
236+
~/.cargo/git/db/
237+
./target/
245238
# this key equals the ones on `linux-build-lib` for re-use
246-
key: cargo-cache-
239+
key: cargo-cache-benchmark-${{ hashFiles('datafusion/**/Cargo.toml', 'benchmarks/Cargo.toml') }}
247240
- name: Setup Rust toolchain
248241
uses: ./.github/actions/setup-builder
249242
with:
@@ -377,12 +370,6 @@ jobs:
377370
- uses: actions/checkout@v4
378371
with:
379372
submodules: true
380-
- name: Cache Cargo
381-
uses: actions/cache@v3
382-
with:
383-
path: /github/home/.cargo
384-
# this key equals the ones on `linux-build-lib` for re-use
385-
key: cargo-cache-
386373
- uses: actions/setup-python@v4
387374
with:
388375
python-version: "3.8"
@@ -480,12 +467,6 @@ jobs:
480467
- uses: actions/checkout@v4
481468
with:
482469
submodules: true
483-
- name: Cache Cargo
484-
uses: actions/cache@v3
485-
with:
486-
path: /github/home/.cargo
487-
# this key equals the ones on `linux-build-lib` for re-use
488-
key: cargo-cache-
489470
- name: Setup Rust toolchain
490471
uses: ./.github/actions/setup-builder
491472
with:
@@ -506,12 +487,6 @@ jobs:
506487
- uses: actions/checkout@v4
507488
with:
508489
submodules: true
509-
- name: Cache Cargo
510-
uses: actions/cache@v3
511-
with:
512-
path: /github/home/.cargo
513-
# this key equals the ones on `linux-build-lib` for re-use
514-
key: cargo-cache-
515490
- name: Setup Rust toolchain
516491
uses: ./.github/actions/setup-builder
517492
with:
@@ -531,12 +506,6 @@ jobs:
531506
- uses: actions/checkout@v4
532507
with:
533508
submodules: true
534-
- name: Cache Cargo
535-
uses: actions/cache@v3
536-
with:
537-
path: /github/home/.cargo
538-
# this key equals the ones on `linux-build-lib` for re-use
539-
key: cargo-cache-
540509
- name: Setup Rust toolchain
541510
uses: ./.github/actions/setup-builder
542511
with:
@@ -563,12 +532,6 @@ jobs:
563532
- uses: actions/checkout@v4
564533
with:
565534
submodules: true
566-
- name: Cache Cargo
567-
uses: actions/cache@v3
568-
with:
569-
path: /github/home/.cargo
570-
# this key equals the ones on `linux-build-lib` for re-use
571-
key: cargo-cache-
572535
- name: Setup Rust toolchain
573536
uses: ./.github/actions/setup-builder
574537
with:

0 commit comments

Comments
 (0)