Skip to content

Commit fddedde

Browse files
committed
Add aggressive build caching
1 parent c2119f6 commit fddedde

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

.github/workflows/build.yml

+28-7
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,26 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212

13+
- name: Cache Rust
14+
uses: actions/cache@v2
15+
id: cache-rust
16+
with:
17+
path: |
18+
~/.cargo/registry
19+
~/.cargo/git
20+
target
21+
key: ${{ runner.os }}-rust-check-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }}
22+
23+
- name: Exit early on cache hit
24+
if: steps.cache-rust.outputs.cache-hit == 'true'
25+
run: exit 0
26+
1327
- name: Install Rust
1428
uses: actions-rs/toolchain@v1
1529
with:
1630
toolchain: stable
1731
override: true
1832

19-
- name: Cache Rust dependencies
20-
uses: Swatinem/rust-cache@v2
21-
2233
- name: Run cargo check
2334
run: cargo check
2435

@@ -42,6 +53,20 @@ jobs:
4253
steps:
4354
- uses: actions/checkout@v2
4455

56+
- name: Cache Rust
57+
uses: actions/cache@v2
58+
id: cache-rust
59+
with:
60+
path: |
61+
~/.cargo/registry
62+
~/.cargo/git
63+
target
64+
key: ${{ runner.os }}-rust-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }}
65+
66+
- name: Exit early on cache hit
67+
if: steps.cache-rust.outputs.cache-hit == 'true'
68+
run: exit 0
69+
4570
- name: Install Rust
4671
uses: actions-rs/toolchain@v1
4772
with:
@@ -55,9 +80,6 @@ jobs:
5580
sudo apt-get update
5681
sudo apt-get install -y libwebkit2gtk-4.1-dev
5782
58-
- name: Cache Rust dependencies
59-
uses: Swatinem/rust-cache@v2
60-
6183
- name: Install cargo-xwin (for Windows build)
6284
if: matrix.target == 'x86_64-pc-windows-msvc'
6385
run: cargo install cargo-xwin
@@ -94,4 +116,3 @@ jobs:
94116
!target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deps
95117
!target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/build
96118
!target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/.fingerprint
97-
retention-days: 7

0 commit comments

Comments
 (0)