11on :
22 pull_request : {}
33 schedule :
4- - cron : ' 30 5,17 * * *'
4+ - cron : ' 30 5,17 * * *'
55 push :
66
77jobs :
88 ci :
99 runs-on : ubuntu-20.04
10+ container : ghcr.io/rust-for-linux/ci
1011 timeout-minutes : 20
1112
1213 strategy :
1314 matrix :
1415 arch : [arm, arm64, ppc64le, riscv64, x86_64]
1516 toolchain : [gcc, clang, llvm]
1617 config : [debug, release]
17- rustc : [1.58.0]
1818 output : [src] # [src, build]
19- install : [rustup] # [rustup, standalone]
2019 sysroot : [common] # [common, custom]
2120 lto : [none] # [none, thin]
2221
@@ -42,71 +41,55 @@ jobs:
4241
4342 # A few independent combinations to avoid exploding the matrix:
4443 # - The other option for `output`.
45- # - Different releases for `rustc` .
44+ # - Whether to use a custom sysroot .
4645 # - 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)
4946 include :
5047 - arch : arm64
5148 toolchain : gcc
5249 config : debug
53- rustc : 1.58.0
5450 output : build
55- install : rustup
5651 sysroot : custom
5752 lto : none
5853
5954 - arch : arm64
6055 toolchain : llvm
6156 config : debug
62- rustc : 1.58.0
6357 output : build
64- install : rustup
6558 sysroot : custom
6659 lto : thin
6760
6861 - arch : arm64
6962 toolchain : llvm
7063 config : release
71- rustc : 1.58.0
7264 output : build
73- install : rustup
7465 sysroot : custom
7566 lto : thin
7667
7768 - arch : ppc64le
7869 toolchain : clang
7970 config : release
80- rustc : 1.58.0
8171 output : build
82- install : standalone
8372 sysroot : common
8473 lto : none
8574
8675 - arch : x86_64
8776 toolchain : llvm
8877 config : debug
89- rustc : 1.58.0
9078 output : build
91- install : standalone
9279 sysroot : custom
9380 lto : none
9481
9582 - arch : x86_64
9683 toolchain : llvm
9784 config : debug
98- rustc : 1.58.0
9985 output : src
100- install : rustup
10186 sysroot : common
10287 lto : thin
10388
10489 - arch : x86_64
10590 toolchain : llvm
10691 config : release
107- rustc : 1.58.0
10892 output : src
109- install : rustup
11093 sysroot : common
11194 lto : thin
11295
@@ -120,10 +103,10 @@ jobs:
120103 # Setup: Github cache
121104 - uses : actions/cache@v2
122105 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 }}
125108 restore-keys : |
126- ${{ env.MATRIX_NAME }}-ccache-
109+ ${{ env.MATRIX_NAME }}-ccache-
127110
128111 # Setup: variables
129112 - if : matrix.arch == 'x86_64'
@@ -169,7 +152,7 @@ jobs:
169152 echo 'QEMU_ARGS=-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf' >> $GITHUB_ENV
170153
171154 - if : matrix.toolchain == 'clang'
172- run : echo 'MAKE_TOOLCHAIN=CC=clang-12 ' >> $GITHUB_ENV
155+ run : echo 'MAKE_TOOLCHAIN=CC=clang' >> $GITHUB_ENV
173156 - if : matrix.toolchain == 'llvm'
174157 run : echo 'MAKE_TOOLCHAIN=LLVM=1' >> $GITHUB_ENV
175158
@@ -184,105 +167,36 @@ jobs:
184167 echo 'MAKE_OUTPUT=O=build' >> $GITHUB_ENV
185168 echo 'BUILD_DIR=build/' >> $GITHUB_ENV
186169
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+
187182 - if : matrix.sysroot == 'custom'
188183 run : |
189184 echo 'RUSTC_SYSROOT=--sysroot=$HOME/sysroot' >> $GITHUB_ENV
190185 echo "MAKE_SYSROOT=KRUSTFLAGS=--sysroot=$HOME/sysroot" >> $GITHUB_ENV
191186
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-
248187 # Setup: rustc native libs
249188 - if : matrix.sysroot == 'custom'
250189 run : |
251190 mkdir $(rustc ${{ env.RUSTC_SYSROOT }} --print sysroot)
252191 ln -s $(rustc --print sysroot)/lib $(rustc ${{ env.RUSTC_SYSROOT }} --print sysroot)/lib
253192
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-
272193 # Setup: ccache
273194 - run : |
274- sudo apt-get install ccache
275195 echo '/usr/lib/ccache:$PATH' >> $GITHUB_PATH
276- echo 'CCACHE_COMPRESS=true' >> $GITHUB_ENV
277196
278197 # Setup: Check existing ccache
279198 - run : ccache -s
280199
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-
286200 # Setup: module parameters test
287201 - run : |
288202 cp samples/rust/rust_module_parameters.rs samples/rust/rust_module_parameters_builtin_default.rs
@@ -314,12 +228,18 @@ jobs:
314228
315229 - run : make ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_LLVM_IAS }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_SYSROOT }} -j3
316230
231+ # Print the final config used
232+ - run : cat ${{ env.BUILD_DIR }}.config
233+
317234 # Make sure `CONFIG_WERROR` was enabled
318235 - run : grep -F 'CONFIG_WERROR=y' ${{ env.BUILD_DIR }}.config
319236
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
322241
242+ # Run
323243 - run : |
324244 qemu-system-${{ env.QEMU_ARCH }} \
325245 ${{ env.QEMU_ARGS }} \
@@ -338,7 +258,7 @@ jobs:
338258 rust_module_parameters_builtin_custom.my_usize=84 \
339259 rust_module_parameters_builtin_custom.my_array=1,2,3 \
340260 ' \
341- | sed s:$'\r' $:: \
261+ | sed 's:\r $::' \
342262 | tee qemu-stdout.log
343263
344264 # The kernel should not be generating any warnings
0 commit comments