@@ -4,6 +4,8 @@ on: [push, pull_request]
4
4
env :
5
5
RUSTDOCFLAGS : -Dwarnings
6
6
RUSTFLAGS : -Dwarnings
7
+ RUST_LLVM_VERSION : 18.0-2024-02-13
8
+ RUST_COMPILER_RT_ROOT : ./compiler-rt
7
9
8
10
jobs :
9
11
test :
@@ -105,11 +107,28 @@ jobs:
105
107
shell : bash
106
108
- run : rustup target add ${{ matrix.target }}
107
109
- run : rustup component add llvm-tools-preview
110
+ - uses : Swatinem/rust-cache@v2
111
+ with :
112
+ key : ${{ matrix.target }}
113
+ - name : Cache Docker layers
114
+ uses : actions/cache@v2
115
+ if : matrix.os == 'ubuntu-latest'
116
+ with :
117
+ path : /tmp/.buildx-cache
118
+ key : ${{ matrix.target }}-buildx-${{ github.sha }}
119
+ restore-keys : ${{ matrix.target }}-buildx-
120
+
121
+ - name : Cache compiler-rt
122
+ id : cache-compiler-rt
123
+ uses : actions/cache@v4
124
+ with :
125
+ path : compiler-rt
126
+ key : ${{ runner.os }}-compiler-rt-${{ env.RUST_LLVM_VERSION }}
108
127
- name : Download compiler-rt reference sources
128
+ if : steps.cache-compiler-rt.outputs.cache-hit != 'true'
109
129
run : |
110
- curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/18.0-2024-02-13.tar.gz
111
- tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-18.0-2024-02-13/compiler-rt
112
- echo RUST_COMPILER_RT_ROOT=./compiler-rt >> $GITHUB_ENV
130
+ curl -L -o code.tar.gz "https://github.com/rust-lang/llvm-project/archive/rustc/${RUST_LLVM_VERSION}.tar.gz"
131
+ tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-${RUST_LLVM_VERSION}/compiler-rt
113
132
shell : bash
114
133
115
134
# Non-linux tests just use our raw script
@@ -120,10 +139,23 @@ jobs:
120
139
NO_STD : ${{ matrix.no_std }}
121
140
TEST_VERBATIM : ${{ matrix.test_verbatim }}
122
141
142
+ # Configure buildx to use Docker layer caching
143
+ - uses : docker/setup-buildx-action@v3
144
+ if : matrix.os == 'ubuntu-latest'
145
+
123
146
# Otherwise we use our docker containers to run builds
124
147
- run : cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
125
148
if : matrix.os == 'ubuntu-latest'
126
149
150
+ # Workaround to keep Docker cache smaller
151
+ # https://github.com/docker/build-push-action/issues/252
152
+ # https://github.com/moby/buildkit/issues/1896
153
+ - name : Move Docker cache
154
+ if : matrix.os == 'ubuntu-latest'
155
+ run : |
156
+ rm -rf /tmp/.buildx-cache
157
+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
158
+
127
159
rustfmt :
128
160
name : Rustfmt
129
161
runs-on : ubuntu-latest
@@ -147,6 +179,7 @@ jobs:
147
179
- name : Install nightly `clippy`
148
180
run : |
149
181
rustup set profile minimal && rustup default "nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)" && rustup component add clippy
182
+ - uses : Swatinem/rust-cache@v2
150
183
- run : cargo clippy -- -D clippy::all
151
184
152
185
success :
0 commit comments