-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (108 loc) · 4.94 KB
/
Copy pathci-kernel.yml
File metadata and controls
111 lines (108 loc) · 4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# ===========================================================================
# agentrt-linux (AirymaxOS) CI Pipeline
# kernel 子仓 CI(Kbuild 矩阵 + 静态分析 + 运行时测试)
# 重组为 2 jobs:kernel-build(编译矩阵)+ kernel-verify(静态分析 + 测试)
# ===========================================================================
# Authority: docs/AirymaxOS/70-build-system/03-ci-cd-pipeline.md
# Constraint: 管理仓每个 workflow 最多 2 条流水线
# Rules: OS-STD-TOOL-161(矩阵)/ OS-STD-TOOL-160(checkpatch)
# OS-STD-TOOL-081-CI(sparse)/ OS-TEST-001~022(KUnit + kselftest)
# ===========================================================================
name: ci-kernel
on:
pull_request:
paths: ['kernel/**']
push:
branches: [main, develop]
paths: ['kernel/**']
jobs:
kernel-build:
name: Kbuild Matrix (31 configs)
runs-on: ubuntu-latest
timeout-minutes: 50
strategy:
fail-fast: false
max-parallel: 8
matrix:
config: [defconfig, allnoconfig, allmodconfig, airy_defconfig]
arch: [x86_64, arm64, riscv, loongarch]
compiler: [gcc, clang]
exclude:
# clang + loongarch not yet supported in upstream toolchain
# (airy_defconfig now available for all 4 archs: x86_64/arm64/riscv/loongarch)
- arch: loongarch
compiler: clang
steps:
- uses: actions/checkout@v4
with: { submodules: recursive }
# ── M1 计划:将以下内联工具链设置提取为 .github/actions/setup-toolchain 复合 action ──
# 当前内联实现原因:P0-10 审查发现 .github/actions/ 目录不存在,IRON-2 禁止桩文件,
# 故 M0 阶段采用内联步骤保证 CI 可用;M1 阶段将重构为复合 action 以消除重复。
- name: Setup toolchain (${{ matrix.arch }} / ${{ matrix.compiler }})
run: |
sudo apt-get update -qq
if [ "${{ matrix.compiler }}" = "gcc" ]; then
case "${{ matrix.arch }}" in
x86_64) sudo apt-get install -y gcc ;;
arm64) sudo apt-get install -y gcc-aarch64-linux-gnu ;;
riscv) sudo apt-get install -y gcc-riscv64-linux-gnu ;;
loongarch) sudo apt-get install -y gcc-loongarch64-linux-gnu ;;
esac
else
sudo apt-get install -y clang lld llvm
fi
- uses: hendrikmuhs/ccache-action@v1
with:
key: kernel-${{ matrix.config }}-${{ matrix.arch }}-${{ matrix.compiler }}
max-size: 2G
- name: Kbuild ${{ matrix.config }} / ${{ matrix.arch }} / ${{ matrix.compiler }}
working-directory: kernel
run: |
make ARCH=${{ matrix.arch }} CC=${{ matrix.compiler }} ${{ matrix.config }}
make ARCH=${{ matrix.arch }} CC=${{ matrix.compiler }} -j$(nproc) W=2 2>&1 | tee build.log
! grep -E "error:|warning:" build.log
kernel-verify:
name: Static Analysis + Runtime Tests
runs-on: ubuntu-latest
needs: kernel-build
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with: { submodules: recursive }
- name: Install static analysis tools
run: sudo apt-get install -y sparse coccinelle
- name: ABI consistency check (OS-IRON-001, 6/6 PASS required)
run: python3 tools/abi-check/abi_check.py --check
- name: Codegen drift check (R-01 SSoT, diff must be empty)
run: python3 tools/codegen/syscall_gen.py --check
- name: Codegen syscall_64.tbl check (R-01 SSoT, Airymax section)
run: python3 tools/codegen/syscall_gen.py --check-tbl
- name: checkpatch.pl --strict (OS-STD-TOOL-160)
run: |
git diff --name-only origin/${{ github.base_ref }} HEAD -- 'kernel/**/*.c' 'kernel/**/*.h' > files.txt
while read f; do
kernel/scripts/checkpatch.pl --strict --no-tree -f "$f" || exit 1
done < files.txt
- name: sparse make C=2 W=2 (OS-STD-TOOL-081-CI)
working-directory: kernel
run: |
make ARCH=x86_64 defconfig
make ARCH=x86_64 C=2 W=2 -j$(nproc) 2>&1 | tee sparse.log
! grep -E "warning:" sparse.log
- name: Coccinelle (make coccicheck)
working-directory: kernel
run: make ARCH=x86_64 coccicheck MODE=report V=1
- name: KUnit on UML (OS-TEST-001~012)
working-directory: kernel
run: |
make ARCH=um defconfig
./tools/testing/kunit/kunit.py run --arch=um --raw_output=TAP
- name: Verify TAP case count monotonic (OS-TEST-012)
run: python3 tools/kunit-tap-diff.py --baseline origin/develop
- name: kselftest on QEMU (OS-TEST-013~022)
working-directory: kernel
run: |
make ARCH=x86_64 defconfig
./tools/testing/kselftest/run_kselftest.sh --tap > /tmp/kselftest.tap
- name: Parse kselftest TAP
run: python3 tools/parse-tap.py --input /tmp/kselftest.tap --fail-on-not-ok