Skip to content

Commit f7c5c28

Browse files
committed
CI: Replace custom caching with rust-cache action
1 parent f984f90 commit f7c5c28

File tree

2 files changed

+5
-102
lines changed

2 files changed

+5
-102
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -69,46 +69,23 @@ jobs:
6969
runs-on: ubuntu-20.04
7070

7171
env:
72-
CARGO_INCREMENTAL: 0
7372
RUSTFLAGS: "-D warnings"
7473

7574
steps:
7675
- uses: actions/checkout@v2
7776

78-
# Current size as of 2021-02-15: ~105 MB
79-
- name: Cache cargo registry and git deps
80-
uses: actions/cache@v2.1.6
81-
with:
82-
path: |
83-
~/.cargo/registry/cache
84-
~/.cargo/registry/index
85-
~/.cargo/git/db
86-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
87-
restore-keys: |
88-
${{ runner.os }}-cargo-
89-
9077
- name: Install Rust
9178
run: |
9279
rustup set profile minimal
9380
# Pin to older version until a clippy regression is fixed
9481
rustup update 1.54.0
9582
rustup default 1.54.0
9683
97-
- id: rustc
98-
run:
99-
echo "::set-output name=version::$(rustc -V)"
100-
101-
- name: Cache cargo build
102-
uses: actions/cache@v2.1.6
103-
with:
104-
path: target
105-
key: v2-${{ runner.os }}-cargo-clippy-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
106-
restore-keys: |
107-
v2-${{ runner.os }}-cargo-clippy-${{ steps.rustc.outputs.version }}-
108-
10984
- run: rustup component add rustfmt
11085
- run: rustup component add clippy
11186

87+
- uses: Swatinem/rust-cache@v1.3.0
88+
11289
- run: cargo fmt -- --check
11390
- run: cargo clippy --all-targets --all-features --all
11491

@@ -127,7 +104,6 @@ jobs:
127104
RUST_BACKTRACE: 1
128105
DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
129106
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
130-
CARGO_INCREMENTAL: 0
131107
RUSTFLAGS: "-D warnings"
132108
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"
133109

@@ -161,29 +137,6 @@ jobs:
161137
fi
162138
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
163139
164-
# Cache `diesel` binary
165-
#
166-
# The other binaries (like `rustc`) will be overwritten by rustup.
167-
#
168-
# Current size as of 2021-02-15: ~15 MB
169-
- name: Cache cargo binaries
170-
uses: actions/cache@v2.1.6
171-
with:
172-
path: ~/.cargo/bin
173-
key: ${{ runner.os }}-cargo-bin-${{ matrix.rust }}-${{ hashFiles('.diesel_version') }}-v3
174-
175-
# Current size as of 2021-02-15: ~105 MB
176-
- name: Cache cargo registry and git deps
177-
uses: actions/cache@v2.1.6
178-
with:
179-
path: |
180-
~/.cargo/registry/cache
181-
~/.cargo/registry/index
182-
~/.cargo/git/db
183-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
184-
restore-keys: |
185-
${{ runner.os }}-cargo-
186-
187140
- name: Install ${{ matrix.rust }} Rust
188141
run: |
189142
if [[ ! -d "$HOME/.cargo" || ! -d "$HOME/.rustup" ]]; then
@@ -194,27 +147,16 @@ jobs:
194147
rustup update ${{ matrix.rust }}
195148
rustup default ${{ matrix.rust }}
196149
197-
- id: rustc
198-
run:
199-
echo "::set-output name=version::$(rustc -V)"
200-
201-
# Current size as of 2021-02-12: ~325 MB
202-
- name: Cache cargo build
203-
uses: actions/cache@v2.1.6
204-
with:
205-
path: target
206-
key: v2-${{ runner.os }}-cargo-build-target-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
207-
restore-keys: |
208-
v2-${{ runner.os }}-cargo-build-target-${{ steps.rustc.outputs.version }}-
150+
- uses: Swatinem/rust-cache@v1.3.0
209151

210152
- name: Setup database
211153
run: |
212-
which diesel || cargo install diesel_cli --vers $(cat .diesel_version) --no-default-features --features postgres --debug
154+
cargo install diesel_cli --vers $(cat .diesel_version) --no-default-features --features postgres --debug
213155
diesel database setup --locked-schema
214156
215157
- name: Install cargo-tarpaulin
216158
if: matrix.rust == 'stable'
217-
run: which cargo-tarpaulin || cargo install cargo-tarpaulin --version ~0.18.0-alpha.3
159+
run: cargo install cargo-tarpaulin --version ~0.18.0-alpha.3
218160

219161
- name: Run tests (with coverage report)
220162
if: matrix.rust == 'stable'
@@ -224,9 +166,6 @@ jobs:
224166
if: matrix.rust != 'stable'
225167
run: cargo test --workspace
226168

227-
- name: Prune unnecessary cache
228-
run: script/ci/prune-cache.sh
229-
230169

231170
# These jobs doesn't actually test anything, but they're only used to tell
232171
# bors the build completed, as there is no practical way to detect when a

script/ci/prune-cache.sh

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)