1
1
on :
2
2
pull_request : {}
3
3
schedule :
4
- - cron : ' 30 5,17 * * *'
4
+ - cron : ' 30 5,17 * * *'
5
5
push :
6
6
7
7
jobs :
8
8
ci :
9
9
runs-on : ubuntu-20.04
10
+ container : ghcr.io/rust-for-linux/ci
10
11
timeout-minutes : 20
11
12
12
13
strategy :
13
14
matrix :
14
15
arch : [arm, arm64, ppc64le, riscv64, x86_64]
15
16
toolchain : [gcc, clang, llvm]
16
17
config : [debug, release]
17
- rustc : [1.58.0]
18
18
output : [src] # [src, build]
19
- install : [rustup] # [rustup, standalone]
20
19
sysroot : [common] # [common, custom]
21
20
lto : [none] # [none, thin]
22
21
@@ -42,71 +41,55 @@ jobs:
42
41
43
42
# A few independent combinations to avoid exploding the matrix:
44
43
# - The other option for `output`.
45
- # - Different releases for `rustc` .
44
+ # - Whether to use a custom sysroot .
46
45
# - Explicitly enabling `lto` on platforms which support LTO.
47
- # - The other three (`install`, `sysroot`) combinations
48
- # (they are interrelated, so the cross-product needs to be tested)
49
46
include :
50
47
- arch : arm64
51
48
toolchain : gcc
52
49
config : debug
53
- rustc : 1.58.0
54
50
output : build
55
- install : rustup
56
51
sysroot : custom
57
52
lto : none
58
53
59
54
- arch : arm64
60
55
toolchain : llvm
61
56
config : debug
62
- rustc : 1.58.0
63
57
output : build
64
- install : rustup
65
58
sysroot : custom
66
59
lto : thin
67
60
68
61
- arch : arm64
69
62
toolchain : llvm
70
63
config : release
71
- rustc : 1.58.0
72
64
output : build
73
- install : rustup
74
65
sysroot : custom
75
66
lto : thin
76
67
77
68
- arch : ppc64le
78
69
toolchain : clang
79
70
config : release
80
- rustc : 1.58.0
81
71
output : build
82
- install : standalone
83
72
sysroot : common
84
73
lto : none
85
74
86
75
- arch : x86_64
87
76
toolchain : llvm
88
77
config : debug
89
- rustc : 1.58.0
90
78
output : build
91
- install : standalone
92
79
sysroot : custom
93
80
lto : none
94
81
95
82
- arch : x86_64
96
83
toolchain : llvm
97
84
config : debug
98
- rustc : 1.58.0
99
85
output : src
100
- install : rustup
101
86
sysroot : common
102
87
lto : thin
103
88
104
89
- arch : x86_64
105
90
toolchain : llvm
106
91
config : release
107
- rustc : 1.58.0
108
92
output : src
109
- install : rustup
110
93
sysroot : common
111
94
lto : thin
112
95
@@ -120,10 +103,10 @@ jobs:
120
103
# Setup: Github cache
121
104
- uses : actions/cache@v2
122
105
with :
123
- path : ~ /.ccache
124
- key : ${{ env.MATRIX_NAME }}-ccache-${{ github.run_id }}
106
+ path : /root /.ccache
107
+ key : ${{ env.MATRIX_NAME }}-ccache-${{ github.run_id }}
125
108
restore-keys : |
126
- ${{ env.MATRIX_NAME }}-ccache-
109
+ ${{ env.MATRIX_NAME }}-ccache-
127
110
128
111
# Setup: variables
129
112
- if : matrix.arch == 'x86_64'
@@ -169,7 +152,7 @@ jobs:
169
152
echo 'QEMU_ARGS=-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf' >> $GITHUB_ENV
170
153
171
154
- if : matrix.toolchain == 'clang'
172
- run : echo 'MAKE_TOOLCHAIN=CC=clang-12 ' >> $GITHUB_ENV
155
+ run : echo 'MAKE_TOOLCHAIN=CC=clang' >> $GITHUB_ENV
173
156
- if : matrix.toolchain == 'llvm'
174
157
run : echo 'MAKE_TOOLCHAIN=LLVM=1' >> $GITHUB_ENV
175
158
@@ -184,105 +167,36 @@ jobs:
184
167
echo 'MAKE_OUTPUT=O=build' >> $GITHUB_ENV
185
168
echo 'BUILD_DIR=build/' >> $GITHUB_ENV
186
169
170
+ # Setup: Rust
171
+ #
172
+ # `rustc` via `rustup` needs to find the `settings.xml` file,
173
+ # but GitHub overrides `$HOME` for containers. Undo it, even
174
+ # if it makes GitHub show some Docker warnings.
175
+ # See https://github.com/actions/runner/issues/863.
176
+ #
177
+ # Note that the commands need to be in their own `run` to have
178
+ # `$HOME` visible for the second one.
179
+ - run : echo 'HOME=/root' >> $GITHUB_ENV
180
+ - run : echo "$HOME/.cargo/bin" >> $GITHUB_PATH
181
+
187
182
- if : matrix.sysroot == 'custom'
188
183
run : |
189
184
echo 'RUSTC_SYSROOT=--sysroot=$HOME/sysroot' >> $GITHUB_ENV
190
185
echo "MAKE_SYSROOT=KRUSTFLAGS=--sysroot=$HOME/sysroot" >> $GITHUB_ENV
191
186
192
- # Setup: custom pre-built binaries folder
193
- - run : |
194
- mkdir bin
195
- echo $(pwd)/bin >> $GITHUB_PATH
196
-
197
- # Setup: LLVM
198
- - run : curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
199
- # Retry to be resilient to intermittent network issues
200
- - run : |
201
- sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' ||
202
- sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' ||
203
- sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main'
204
- - run : sudo apt-get update -y
205
- - run : sudo apt-get install -y llvm-12 clang-12 lld-12 --fix-missing
206
- - run : echo $(llvm-config-12 --bindir) >> $GITHUB_PATH
207
-
208
- # Setup: GCC
209
- - if : matrix.arch == 'arm'
210
- run : sudo apt-get install -y gcc-arm-linux-gnueabi lzop
211
- - if : matrix.arch == 'arm64'
212
- run : sudo apt-get install -y gcc-aarch64-linux-gnu
213
- - if : matrix.arch == 'ppc64le'
214
- run : sudo apt-get install -y gcc-powerpc64le-linux-gnu
215
- - if : matrix.arch == 'riscv64'
216
- run : sudo apt-get install -y gcc-riscv64-linux-gnu
217
-
218
- # Setup OpenSBI
219
- - if : matrix.arch == 'riscv64'
220
- run : sudo apt-get install -y opensbi
221
-
222
- # Setup: libelf
223
- - run : sudo apt-get install -y libelf-dev
224
-
225
- # Setup: QEMU
226
- - if : matrix.arch == 'x86_64'
227
- run : sudo apt-get install -y qemu-system-x86
228
- - if : matrix.arch == 'arm' || matrix.arch == 'arm64'
229
- run : sudo apt-get install -y qemu-system-arm
230
- - if : matrix.arch == 'ppc64le'
231
- run : sudo apt-get install -y qemu-system-ppc
232
- - if : matrix.arch == 'riscv64'
233
- run : |
234
- curl -o bin/qemu-system-riscv64 https://raw.githubusercontent.com/Rust-for-Linux/ci-bin/master/qemu-6.0.0/bin/qemu-system-riscv64
235
- chmod u+x bin/qemu-system-riscv64
236
-
237
- # Setup: rustc
238
- - if : matrix.install == 'rustup'
239
- run : |
240
- rustup default ${{ matrix.rustc }}
241
- rustup component add rustfmt
242
- - if : matrix.install == 'standalone'
243
- run : |
244
- curl https://static.rust-lang.org/dist/rust-${{ matrix.rustc }}-x86_64-unknown-linux-gnu.tar.gz | tar xz
245
- rust-${{ matrix.rustc }}-x86_64-unknown-linux-gnu/install.sh --without=rust-docs --prefix=$HOME/rustc
246
- echo $HOME/rustc/bin >> $GITHUB_PATH
247
-
248
187
# Setup: rustc native libs
249
188
- if : matrix.sysroot == 'custom'
250
189
run : |
251
190
mkdir $(rustc ${{ env.RUSTC_SYSROOT }} --print sysroot)
252
191
ln -s $(rustc --print sysroot)/lib $(rustc ${{ env.RUSTC_SYSROOT }} --print sysroot)/lib
253
192
254
- # Setup: rustc source
255
- - if : matrix.install == 'rustup' && matrix.sysroot == 'common'
256
- run : rustup component add rust-src
257
- - if : matrix.install != 'rustup' || matrix.sysroot != 'common'
258
- run : |
259
- git clone -n https://github.com/rust-lang/rust $(rustc ${{ env.RUSTC_SYSROOT }} --print sysroot)/lib/rustlib/src/rust
260
- cd $(rustc ${{ env.RUSTC_SYSROOT }} --print sysroot)/lib/rustlib/src/rust
261
- git checkout $(rustc -vV | grep -F 'commit-hash' | awk '{print $2}')
262
- git submodule update --init library
263
-
264
- # Setup: clippy
265
- - run : rustup component add clippy
266
-
267
- # Setup: bindgen
268
- - run : |
269
- curl -o bin/bindgen https://raw.githubusercontent.com/Rust-for-Linux/ci-bin/master/bindgen-0.56.0/bin/bindgen
270
- chmod u+x bin/bindgen
271
-
272
193
# Setup: ccache
273
194
- run : |
274
- sudo apt-get install ccache
275
195
echo '/usr/lib/ccache:$PATH' >> $GITHUB_PATH
276
- echo 'CCACHE_COMPRESS=true' >> $GITHUB_ENV
277
196
278
197
# Setup: Check existing ccache
279
198
- run : ccache -s
280
199
281
- # Setup: busybox
282
- - run : git clone --depth 1 -b 1_30_1 https://github.com/mirror/busybox
283
- - run : mv .github/workflows/busybox.config busybox/.config
284
- - run : cd busybox && make ${{ env.MAKE_CROSS_COMPILE }} -j3
285
-
286
200
# Setup: module parameters test
287
201
- run : |
288
202
cp samples/rust/rust_module_parameters.rs samples/rust/rust_module_parameters_builtin_default.rs
@@ -314,12 +228,18 @@ jobs:
314
228
315
229
- run : make ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_LLVM_IAS }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_SYSROOT }} -j3
316
230
231
+ # Print the final config used
232
+ - run : cat ${{ env.BUILD_DIR }}.config
233
+
317
234
# Make sure `CONFIG_WERROR` was enabled
318
235
- run : grep -F 'CONFIG_WERROR=y' ${{ env.BUILD_DIR }}.config
319
236
320
- # Run
321
- - run : ${{ env.BUILD_DIR }}usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
237
+ # Prepare image
238
+ - run : |
239
+ mv $HOME/busybox-${{ matrix.arch }} busybox
240
+ ${{ env.BUILD_DIR }}usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
322
241
242
+ # Run
323
243
- run : |
324
244
qemu-system-${{ env.QEMU_ARCH }} \
325
245
${{ env.QEMU_ARGS }} \
@@ -338,7 +258,7 @@ jobs:
338
258
rust_module_parameters_builtin_custom.my_usize=84 \
339
259
rust_module_parameters_builtin_custom.my_array=1,2,3 \
340
260
' \
341
- | sed s:$'\r' $:: \
261
+ | sed 's:\r $::' \
342
262
| tee qemu-stdout.log
343
263
344
264
# The kernel should not be generating any warnings
0 commit comments