11name : Rust
22
3- on : [push]
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - master
48
59jobs :
610 build :
@@ -10,38 +14,34 @@ jobs:
1014 steps :
1115 - uses : actions/checkout@v1
1216
13- - name : Cache rust
14- id : cache_rust
15- uses : actions/cache@v1
16- with :
17- path : ~/.rustup/toolchains
18- key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
17+ # Rust ------------------------------------------------
1918
20- - name : Cache cargo registry
21- uses : actions/cache@v1
22- with :
23- path : ~/.cargo/registry
24- key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
25-
26- - name : Cache cargo index
27- uses : actions/cache@v1
19+ - name : Install Rust toolchain
20+ uses : actions-rs/toolchain@v1
21+ if : steps.cache_rust.outputs.cache-hit != 'true'
2822 with :
29- path : ~/.cargo/git
30- key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
31-
32- - name : Cache cargo build
23+ toolchain : stable
24+ profile : minimal
25+ override : true
26+
27+ - name : Cache target/
3328 uses : actions/cache@v1
3429 with :
3530 path : target
3631 key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
3732
38- - name : Setup rust
39- uses : actions-rs/toolchain@v1
40- if : steps.cache_rust.outputs.cache-hit != 'true'
41- with :
42- toolchain : stable
43- override : true
33+ # -----------------------------------------------------
4434
4535 - run : cargo check --all-features
4636
4737 - run : cargo test -p sqlx-core --all-features
38+
39+ # Rust ------------------------------------------------
40+
41+ - name : Prepare build directory for cache
42+ run : |
43+ find ./target/debug -maxdepth 1 -type f -delete \
44+ && rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
45+ && rm -f ./target/.rustc_info.json
46+
47+ # -----------------------------------------------------
0 commit comments