Skip to content

Commit 3ae512d

Browse files
committed
ci: move to containers
This allows us to use different (and in particular, newer) Ubuntu images, it is easier to move it to another CI and to use it locally by others. This, in turn, gives us easy access to e.g. newer GCCs like 11.2 which may spot other issues, like the one by the Intel CI the other day (which I wanted to reproduce in the CI -- this commit includes enabling the config option that triggered it). It also allows us to drop `ci-bin`, since we get QEMU 6.0 from Ubuntu and we can compile BusyBox too. It should also avoid most networking issues since we rely only on content from GitHub. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent abc65ff commit 3ae512d

9 files changed

+36
-111
lines changed

.github/workflows/ci.yaml

Lines changed: 21 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ on:
77
jobs:
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,7 +103,7 @@ jobs:
120103
# Setup: Github cache
121104
- uses: actions/cache@v2
122105
with:
123-
path: ~/.ccache
106+
path: /root/.ccache
124107
key: ${{ env.MATRIX_NAME }}-ccache-${{ github.run_id }}
125108
restore-keys: |
126109
${{ env.MATRIX_NAME }}-ccache-
@@ -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,104 +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
276196
277197
# Setup: Check existing ccache
278198
- run: ccache -s
279199

280-
# Setup: busybox
281-
- run: git clone --depth 1 -b 1_30_1 https://github.com/mirror/busybox
282-
- run: mv .github/workflows/busybox.config busybox/.config
283-
- run: cd busybox && make ${{ env.MAKE_CROSS_COMPILE }} -j3
284-
285200
# Setup: module parameters test
286201
- run: |
287202
cp samples/rust/rust_module_parameters.rs samples/rust/rust_module_parameters_builtin_default.rs
@@ -319,9 +234,12 @@ jobs:
319234
# Make sure `CONFIG_WERROR` was enabled
320235
- run: grep -F 'CONFIG_WERROR=y' ${{ env.BUILD_DIR }}.config
321236

322-
# Run
323-
- 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
324241
242+
# Run
325243
- run: |
326244
qemu-system-${{ env.QEMU_ARCH }} \
327245
${{ env.QEMU_ARGS }} \

.github/workflows/kernel-arm-debug.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,4 +1829,5 @@ CONFIG_RUST_BUILD_ASSERT_DENY=y
18291829
# end of Rust hacking
18301830
# end of Kernel hacking
18311831

1832-
CONFIG_WERROR=y
1832+
CONFIG_WERROR=y
1833+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/kernel-arm64-debug-thinlto.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,4 +1478,5 @@ CONFIG_RUST_BUILD_ASSERT_DENY=y
14781478
# end of Rust hacking
14791479
# end of Kernel hacking
14801480

1481-
CONFIG_WERROR=y
1481+
CONFIG_WERROR=y
1482+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/kernel-arm64-debug.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,4 +1473,5 @@ CONFIG_RUST_BUILD_ASSERT_DENY=y
14731473
# end of Rust hacking
14741474
# end of Kernel hacking
14751475

1476-
CONFIG_WERROR=y
1476+
CONFIG_WERROR=y
1477+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/kernel-ppc64le-debug.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1594,4 +1594,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
15941594
# end of Rust hacking
15951595
# end of Kernel hacking
15961596

1597-
CONFIG_WERROR=y
1597+
CONFIG_WERROR=y
1598+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/kernel-riscv64-debug.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,4 +1322,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
13221322
# end of Rust hacking
13231323
# end of Kernel hacking
13241324

1325-
CONFIG_WERROR=y
1325+
CONFIG_WERROR=y
1326+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/kernel-x86_64-debug-thinlto.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,4 +1545,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
15451545
# end of Rust hacking
15461546
# end of Kernel hacking
15471547

1548-
CONFIG_WERROR=y
1548+
CONFIG_WERROR=y
1549+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/kernel-x86_64-debug.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,4 +1548,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
15481548
# end of Rust hacking
15491549
# end of Kernel hacking
15501550

1551-
CONFIG_WERROR=y
1551+
CONFIG_WERROR=y
1552+
CONFIG_ZERO_CALL_USED_REGS=y

.github/workflows/qemu-initramfs.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dir /bin 0755 0 0
22
dir /sys 0755 0 0
33
dir /dev 0755 0 0
4-
file /bin/busybox busybox/busybox 0755 0 0
4+
file /bin/busybox busybox 0755 0 0
55
slink /bin/sh /bin/busybox 0755 0 0
66
file /init .github/workflows/qemu-init.sh 0755 0 0
77

0 commit comments

Comments
 (0)