Skip to content

Commit 3a73ef5

Browse files
committed
Simplify and update CI without container
Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8991822 commit 3a73ef5

6 files changed

+1281
-128
lines changed

.github/workflows/ci.yaml

+51-126
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,21 @@ on:
77
jobs:
88
ci:
99
runs-on: ubuntu-24.04
10-
container: ghcr.io/rust-for-linux/ci
1110

1211
timeout-minutes: 70
1312

1413
strategy:
1514
fail-fast: false
1615
matrix:
1716
tree:
18-
- rust-next
19-
# rust-fixes
20-
# rust-dev
21-
17+
- torvalds
18+
# rust-next
2219
# next
2320

24-
# stable/linux-6.7.y
25-
# stable-rc/linux-6.7.y
26-
27-
# stable/linux-6.6.y
28-
# stable-rc/linux-6.6.y
29-
30-
# stable/linux-6.1.y
31-
# stable-rc/linux-6.1.y
32-
3321
arch:
3422
- x86_64
3523
# arm64
3624

37-
toolchain:
38-
# llvm
39-
- rustc_codegen_gcc
40-
4125
config:
4226
- defconfig
4327
- defconfig+debug
@@ -47,44 +31,6 @@ jobs:
4731
# subdir
4832
# outside
4933

50-
include:
51-
# # `arch: arm64` (with `rust-dev`).
52-
# - tree: rust-dev
53-
# arch: arm64
54-
# toolchain: rustc_codegen_gcc
55-
# config: defconfig
56-
# output: src
57-
#
58-
# # `arch: arm64` (with `rust-dev` + `defconfig+debug`).
59-
# - tree: rust-dev
60-
# arch: arm64
61-
# toolchain: rustc_codegen_gcc
62-
# config: defconfig+debug
63-
# output: src
64-
65-
# `output: subdir`.
66-
- tree: rust-next
67-
arch: x86_64
68-
toolchain: rustc_codegen_gcc
69-
config: defconfig
70-
output: subdir
71-
72-
# `output: outside`.
73-
- tree: rust-next
74-
arch: x86_64
75-
toolchain: rustc_codegen_gcc
76-
config: defconfig
77-
output: outside
78-
79-
exclude:
80-
# Rust 1.71.1 (in Linux 6.6) had a bug: it generated `.eh_frame` with debug assertions enabled.
81-
- tree: stable/linux-6.6.y
82-
config: defconfig+debug
83-
84-
# Rust 1.71.1 (in Linux 6.6) had a bug: it generated `.eh_frame` with debug assertions enabled.
85-
- tree: stable-rc/linux-6.6.y
86-
config: defconfig+debug
87-
8834
env:
8935
RUST_VERSION: nightly-2025-01-12
9036
steps:
@@ -105,9 +51,6 @@ jobs:
10551
echo 'QEMU_ARCH=aarch64' >> $GITHUB_ENV
10652
echo 'QEMU_ARGS=-machine virt' >> $GITHUB_ENV
10753
108-
- if: matrix.toolchain == 'llvm'
109-
run: echo 'MAKE_TOOLCHAIN=LLVM=1' >> $GITHUB_ENV
110-
11154
- if: matrix.output == 'src'
11255
run: |
11356
echo 'OUTPUT_DIR=linux/' >> $GITHUB_ENV
@@ -117,18 +60,23 @@ jobs:
11760
echo 'OUTPUT_DIR=linux/subdir/' >> $GITHUB_ENV
11861
- if: matrix.output == 'outside'
11962
run: |
120-
echo 'MAKE_OUTPUT=O=/outside' >> $GITHUB_ENV
121-
echo 'OUTPUT_DIR=/outside/' >> $GITHUB_ENV
63+
echo 'MAKE_OUTPUT=O=../outside' >> $GITHUB_ENV
64+
echo 'OUTPUT_DIR=outside/' >> $GITHUB_ENV
65+
66+
- run: |
67+
sudo apt-get -y update
68+
sudo apt-get -y --no-install-recommends install bc file git make flex bison libelf-dev libssl-dev curl python3 llvm clang lld binutils qemu-system-x86 qemu-system-arm
69+
70+
- if: matrix.arch == 'arm64'
71+
run: sudo apt-get -y --no-install-recommends install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
12272

12373
# Setup: checkout Linux source tree.
74+
- if: matrix.tree == 'torvalds'
75+
run: git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux
12476
- if: startsWith(matrix.tree, 'rust-')
12577
run: git clone --depth 1 --branch ${{ matrix.tree }} https://github.com/Rust-for-Linux/linux.git linux
126-
- if: startsWith(matrix.tree, 'next')
78+
- if: matrix.tree == 'next'
12779
run: git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux
128-
- if: startsWith(matrix.tree, 'stable/')
129-
run: git clone --depth 1 --branch $(echo ${{ matrix.tree }} | cut -d/ -f2-) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux
130-
- if: startsWith(matrix.tree, 'stable-rc/')
131-
run: git clone --depth 1 --branch $(echo ${{ matrix.tree }} | cut -d/ -f2-) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux
13280

13381
- run: git -C linux show --no-patch
13482

@@ -137,6 +85,14 @@ jobs:
13785
with:
13886
path: ci
13987

88+
- run: git -C linux apply ../ci/x86-boot-Use-std-gnu11-to-fix-build-with-GCC-15.patch
89+
90+
# Setup: `busybox`.
91+
- run: |
92+
git clone --depth 1 -b 1_30_1 https://git.busybox.net/busybox/
93+
mv ci/busybox.config busybox/.config
94+
make -C busybox ${{ env.MAKE_CROSS_COMPILE }} ${{ env.JOBS }} busybox
95+
14096
# Setup: Rust.
14197
- run: |
14298
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
@@ -150,11 +106,10 @@ jobs:
150106
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
151107
152108
# Setup: `rustc_codegen_gcc`.
153-
- if: matrix.toolchain == 'rustc_codegen_gcc'
154-
run: |
155-
apt-get -y --no-install-recommends purge cpp gcc
109+
- run: |
110+
sudo apt-get -y --no-install-recommends purge cpp gcc
156111
curl --proto '=https' --tlsv1.2 -sSfLO https://github.com/rust-lang/gcc/releases/latest/download/gcc-15.deb
157-
dpkg -i gcc-15.deb
112+
sudo dpkg -i gcc-15.deb
158113
159114
git clone --depth 1 https://github.com/rust-lang/rustc_codegen_gcc
160115
@@ -168,14 +123,7 @@ jobs:
168123
./y.sh build --sysroot --release
169124
170125
# Setup: `bindgen`.
171-
#
172-
# The `bindgen` package name is only used for 6.1 LTS.
173-
- run: |
174-
cargo install --locked --version 0.70.1 bindgen-cli ||
175-
cargo install --locked --version 0.70.1 bindgen
176-
177-
# Setup: `busybox`.
178-
- run: cp /root/busybox-${{ matrix.arch }} /root/busybox
126+
- run: cargo install --locked --version 0.70.1 bindgen-cli
179127

180128
# Prepare build output folder.
181129
- if: matrix.output != 'src'
@@ -206,30 +154,10 @@ jobs:
206154
- run: diff -u config-before ${{ env.OUTPUT_DIR }}.config
207155

208156
# Make sure certain key configs were enabled.
209-
- run: |
210-
grep -F 'CONFIG_RUST=y' ${{ env.OUTPUT_DIR }}.config
211-
grep -F 'CONFIG_WERROR=y' ${{ env.OUTPUT_DIR }}.config
212-
213-
# Prepare image.
214-
- run: ${{ env.OUTPUT_DIR }}usr/gen_init_cpio ci/qemu-initramfs.desc > qemu-initramfs.img
215-
216-
# Run in QEMU.
217-
- run: |
218-
qemu-system-${{ env.QEMU_ARCH }} \
219-
${{ env.QEMU_ARGS }} \
220-
-kernel ${{ env.OUTPUT_DIR }}${{ env.IMAGE_PATH }} \
221-
-initrd qemu-initramfs.img \
222-
-smp 2 \
223-
-nographic \
224-
-vga none \
225-
-no-reboot \
226-
| sed 's:\r$::' \
227-
| tee qemu-stdout
157+
- run: grep -F 'CONFIG_RUST=y' ${{ env.OUTPUT_DIR }}.config
228158

229159
# Report other data.
230160
- run: |
231-
ls -l
232-
233161
ls -l \
234162
${{ env.OUTPUT_DIR }}samples/rust/*.o \
235163
${{ env.OUTPUT_DIR }}samples/rust/*.ko \
@@ -245,19 +173,27 @@ jobs:
245173
246174
# Check `.comment` section.
247175
- run: |
248-
# TODO: update version here.
249-
if [ $(linux/scripts/min-tool-version.sh rustc | cut -d'.' -f2) -ge 73 ]; then
250-
llvm-readelf --string-dump .comment ${{ env.OUTPUT_DIR }}rust/core.o
251-
llvm-objcopy --dump-section .comment=comment ${{ env.OUTPUT_DIR }}rust/core.o
252-
# TODO: update version here.
253-
grep --text "^.rustc version $(linux/scripts/min-tool-version.sh rustc)" comment
254-
if ${{ matrix.toolchain == 'rustc_codegen_gcc' && 'true' || 'false' }}; then
255-
grep --text 'libgccjit' comment
256-
grep --text 'GCC: ' comment
257-
fi
258-
else
259-
echo 'Skipping since `rustc` < 1.73.0.'
260-
fi
176+
readelf --string-dump .comment ${{ env.OUTPUT_DIR }}rust/core.o
177+
objcopy --dump-section .comment=comment ${{ env.OUTPUT_DIR }}rust/core.o
178+
grep --text "^.rustc version .* with libgccjit" comment
179+
grep --text 'libgccjit' comment
180+
grep --text 'GCC: ' comment
181+
182+
# Prepare image.
183+
- run: ${{ env.OUTPUT_DIR }}usr/gen_init_cpio ci/qemu-initramfs.desc > qemu-initramfs.img
184+
185+
# Run in QEMU.
186+
- run: |
187+
qemu-system-${{ env.QEMU_ARCH }} \
188+
${{ env.QEMU_ARGS }} \
189+
-kernel ${{ env.OUTPUT_DIR }}${{ env.IMAGE_PATH }} \
190+
-initrd qemu-initramfs.img \
191+
-smp 2 \
192+
-nographic \
193+
-vga none \
194+
-no-reboot \
195+
| sed 's:\r$::' \
196+
| tee qemu-stdout
261197
262198
# Check QEMU log output.
263199
- run: |
@@ -266,9 +202,7 @@ jobs:
266202
grep '] rust_minimal: My numbers are \[72, 108, 200]$' qemu-stdout
267203
grep '] rust_minimal: Rust minimal sample (exit)$' qemu-stdout
268204
269-
# Linux 6.1 does not have `rust_print`.
270-
- if: ${{ ! contains(matrix.tree, '6.1') }}
271-
run: |
205+
- run: |
272206
grep '] rust_print: Rust printing macros sample (init)$' qemu-stdout
273207
274208
grep '] rust_print: Emergency message (level 0) without args$' qemu-stdout
@@ -289,9 +223,7 @@ jobs:
289223
grep '] rust_print: Info message (level 6) with args$' qemu-stdout
290224
grep '] rust_print: A line that is continued with args$' qemu-stdout
291225
292-
# Linux 6.1 does not have KUnit `rustdoc` tests.
293-
- if: ${{ matrix.config == 'defconfig+debug' && ! contains(matrix.tree, '6.1') }}
294-
run: grep '] ok 1 rust_doctests_kernel$' qemu-stdout
226+
- run: grep '] ok 1 rust_doctests_kernel$' qemu-stdout
295227

296228
- run: |
297229
grep -i '\bpanic\b' qemu-stdout && exit 1
@@ -334,20 +266,13 @@ jobs:
334266
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.o
335267
file ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.o | grep -F 'ELF'
336268
337-
# Rust 1.71.1 (in Linux 6.6) had a bug: it does not generate dependency files.
338-
- if: ${{ ! contains(matrix.tree, '6.6') }}
339-
run: |
269+
- run: |
340270
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.rsi
341271
grep -F '#![feature(prelude_import)]' ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.rsi
342272
343273
- run: |
344274
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.s
345275
grep -F '.text' ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.s
346276
347-
- if: matrix.toolchain == 'llvm'
348-
run: |
349-
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.ll
350-
grep -F '; ModuleID' ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.ll
351-
352277
# Test Rust host programs.
353278
- run: ${{ env.OUTPUT_DIR }}samples/rust/hostprogs/single | grep -F 'The number is 42.'

0 commit comments

Comments
 (0)