Skip to content

Commit 9fd466c

Browse files
committed
fix(actions): use rust-cache action
I think the CI failures we've been seeing lately are due to bad incremental compilation artifacts being cached. The rust-cache action is smarter about what it actually caches.
1 parent b9a8f90 commit 9fd466c

File tree

1 file changed

+16
-49
lines changed

1 file changed

+16
-49
lines changed

.github/workflows/sqlx.yml

+16-49
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@ jobs:
4343
toolchain: stable
4444
override: true
4545

46-
- uses: actions/cache@v2
46+
- uses: Swatinem/rust-cache@v1
4747
with:
48-
path: |
49-
~/.cargo/registry
50-
~/.cargo/git
51-
target
52-
key: ${{ runner.os }}-check-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
53-
48+
key: ${{ runner.os }}-check-${{ matrix.runtime }}-${{ matrix.tls }}
49+
5450
- uses: actions-rs/cargo@v1
5551
with:
5652
command: check
@@ -82,13 +78,9 @@ jobs:
8278
toolchain: stable
8379
override: true
8480

85-
- uses: actions/cache@v2
81+
- uses: Swatinem/rust-cache@v1
8682
with:
87-
path: |
88-
~/.cargo/registry
89-
~/.cargo/git
90-
target
91-
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
83+
key: ${{ runner.os }}-test
9284

9385
- uses: actions-rs/cargo@v1
9486
with:
@@ -127,13 +119,9 @@ jobs:
127119
target: ${{ matrix.target }}
128120
override: true
129121

130-
- uses: actions/cache@v2
122+
- uses: Swatinem/rust-cache@v1
131123
with:
132-
path: |
133-
~/.cargo/registry
134-
~/.cargo/git
135-
target
136-
key: ${{ runner.os }}-cli-${{ hashFiles('**/Cargo.lock') }}
124+
key: ${{ runner.os }}-cli
137125

138126
- uses: actions-rs/cargo@v1
139127
with:
@@ -162,13 +150,9 @@ jobs:
162150
toolchain: stable
163151
override: true
164152

165-
- uses: actions/cache@v2
153+
- uses: Swatinem/rust-cache@v1
166154
with:
167-
path: |
168-
~/.cargo/registry
169-
~/.cargo/git
170-
target
171-
key: ${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
155+
key: ${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}
172156

173157
- uses: actions-rs/cargo@v1
174158
with:
@@ -199,13 +183,9 @@ jobs:
199183
toolchain: stable
200184
override: true
201185

202-
- uses: actions/cache@v2
186+
- uses: Swatinem/rust-cache@v1
203187
with:
204-
path: |
205-
~/.cargo/registry
206-
~/.cargo/git
207-
target
208-
key: ${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
188+
key: ${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}
209189

210190
- uses: actions-rs/cargo@v1
211191
env:
@@ -263,13 +243,9 @@ jobs:
263243
toolchain: stable
264244
override: true
265245

266-
- uses: actions/cache@v2
246+
- uses: Swatinem/rust-cache@v1
267247
with:
268-
path: |
269-
~/.cargo/registry
270-
~/.cargo/git
271-
target
272-
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
248+
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
273249

274250
- uses: actions-rs/cargo@v1
275251
with:
@@ -307,14 +283,9 @@ jobs:
307283
toolchain: stable
308284
override: true
309285

310-
# same Cargo features as MySQL so the same cache can be used
311-
- uses: actions/cache@v2
286+
- uses: Swatinem/rust-cache@v1
312287
with:
313-
path: |
314-
~/.cargo/registry
315-
~/.cargo/git
316-
target
317-
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
288+
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
318289

319290
- uses: actions-rs/cargo@v1
320291
with:
@@ -352,12 +323,8 @@ jobs:
352323
toolchain: stable
353324
override: true
354325

355-
- uses: actions/cache@v2
326+
- uses: Swatinem/rust-cache@v1
356327
with:
357-
path: |
358-
~/.cargo/registry
359-
~/.cargo/git
360-
target
361328
key: ${{ runner.os }}-mssql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
362329

363330
- uses: actions-rs/cargo@v1

0 commit comments

Comments
 (0)