Skip to content

Commit c17d290

Browse files
authored
Merge pull request #16 from Rust-for-Linux/github-ci
Add CI
2 parents 58ffd76 + 453d1ac commit c17d290

File tree

7 files changed

+2834
-0
lines changed

7 files changed

+2834
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on: [pull_request, push]
2+
3+
jobs:
4+
ci:
5+
runs-on: ubuntu-20.04
6+
timeout-minutes: 15
7+
8+
strategy:
9+
matrix:
10+
mode: [debug, release]
11+
module: [builtin, loadable]
12+
13+
steps:
14+
# Setup
15+
- uses: actions/checkout@v2
16+
- run: sudo apt install libelf-dev qemu-system-x86 busybox-static
17+
- run: rustup default nightly-2020-08-27
18+
- run: rustup component add rust-src
19+
20+
# Build
21+
- run: cp .github/workflows/kernel-${{ matrix.mode }}.config .config
22+
- if: matrix.module == 'loadable'
23+
run: sed -i -E 's/^(CONFIG_RUST_EXAMPLE=)(y)$/\1m/g' .config
24+
- run: make CC=clang-10 LLVM_CONFIG_PATH=llvm-config-10 -j3
25+
26+
# Run
27+
- if: matrix.module == 'builtin'
28+
run: sed -i '/rust_example/d' .github/workflows/qemu-initramfs.desc
29+
- run: usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
30+
- run: qemu-system-x86_64 -kernel arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" -nographic -no-reboot | tee qemu-stdout.log
31+
32+
# Check
33+
- run: grep -F 'Rust Example (init)' qemu-stdout.log
34+
- run: "grep 'my_i32: \\+123321' qemu-stdout.log"
35+
- if: matrix.module == 'loadable'
36+
run: grep -F 'Rust Example (exit)' qemu-stdout.log

0 commit comments

Comments
 (0)