@@ -86,39 +86,16 @@ jobs:
86
86
fi
87
87
echo "::add-path::$HOME/.cargo/bin"
88
88
89
- # FIXME: Nightly and beta channels have high churn. The cache quickly expires, but there is
90
- # no way (that I can find) to overwrite an existing cache. There is also no way to
91
- # dynamically include the latest version number for a release channel into the cache `key`
92
- # value. Once a cached release becomes stale, every job will begin downloading the latest
93
- # release from upstream and the cache becomes useless for that channel.
89
+ # Cache `diesel` binary
94
90
#
95
- # Including `hashFiles('**/Cargo.lock')` below is a hack. Ideally, we would change the `key`
96
- # for each channel at the same rate as the release cadence for that channel. For the stable
97
- # channel this is too frequent and for the nightly channel (and probably beta as well) it is
98
- # not often enough.
99
- #
100
- # Current size as of 2019-12-23: ~123 MB
101
- - name : Cache rustup
102
- uses : actions/cache@v1
103
- with :
104
- path : ~/.rustup
105
- key : ${{ runner.os }}-rustup-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
106
- restore-key : |
107
- ${{ runner.os }}-rustup-${{ matrix.rust }}-
108
- ${{ runner.os }}-rustup-
109
-
110
- # This step has the same tradeoffs as `Cache rustup`, however the cache size is significantly
111
- # smaller. The installed `diesel` binary is also stored here.
91
+ # The other binaries (like `rustc`) will be overwritten by rustup.
112
92
#
113
93
# Current size as of 2019-12-23: ~6 MB
114
94
- name : Cache cargo binaries
115
95
uses : actions/cache@v1
116
96
with :
117
97
path : ~/.cargo/bin
118
- key : ${{ runner.os }}-cargo-bin-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
119
- restore-key : |
120
- ${{ runner.os }}-cargo-bin-${{ matrix.rust }}-
121
- ${{ runner.os }}-cargo-bin-
98
+ key : ${{ runner.os }}-cargo-bin-${{ matrix.rust }}-${{ hashFiles('.diesel_version') }}
122
99
123
100
# Current size as of 2019-12-23: ~77 MB
124
101
- name : Cache cargo registry cache
@@ -150,16 +127,6 @@ jobs:
150
127
${{ runner.os }}-cargo-git-db-${{ matrix.rust }}-
151
128
${{ runner.os }}-cargo-git-db-
152
129
153
- # Current size as of 2019-12-23: ~336 MB
154
- - name : Cache cargo build
155
- uses : actions/cache@v1
156
- with :
157
- path : target
158
- key : ${{ runner.os }}-cargo-build-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
159
- restore-key : |
160
- ${{ runner.os }}-cargo-build-target-${{ matrix.rust }}-
161
- ${{ runner.os }}-cargo-build-target-
162
-
163
130
- name : Install ${{ matrix.rust }} Rust
164
131
run : |
165
132
if [[ ! -d "$HOME/.cargo" || ! -d "$HOME/.rustup" ]]; then
@@ -176,6 +143,19 @@ jobs:
176
143
rustup component add rustfmt
177
144
rustup component add clippy
178
145
146
+ - id : rustc
147
+ run :
148
+ echo "::set-output name=version::$(rustc -V)"
149
+
150
+ # Current size as of 2019-12-23: ~336 MB
151
+ - name : Cache cargo build
152
+ uses : actions/cache@v1
153
+ with :
154
+ path : target
155
+ key : ${{ runner.os }}-cargo-build-target-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
156
+ restore-key : |
157
+ ${{ runner.os }}-cargo-build-target-${{ steps.rustc.outputs.version }}-
158
+
179
159
- name : Cargo clean on new rustc version
180
160
run : script/ci/cargo-clean-on-new-rustc-version.sh
181
161
0 commit comments