forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 152
210 lines (199 loc) · 6.88 KB
/
ci.yml
File metadata and controls
210 lines (199 loc) · 6.88 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: 'CI'
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
tests:
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- displayTargetName: linux
os: unix
runs_on: ubuntu-22.04
shell: bash
- displayTargetName: kunit
os: unix
runs_on: ubuntu-22.04
shell: bash
build_options: "kunit=yes"
- displayTargetName: mmu_kasan
os: unix
runs_on: ubuntu-22.04
shell: bash
build_options: "MMU=1 MMU_KUNIT=1 kasan=yes"
- displayTargetName: windows-2022
os: windows
runs_on: windows-2022
pip_option: --break-system-packages
shell: msys2 {0}
- displayTargetName: clang-build
os: unix
runs_on: ubuntu-22.04
shell: bash
build_options: "LLVM=1 CROSS_COMPILE=x86_64-linux-gnu"
timeout-minutes: 100
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Set env
shell: bash
run: |
echo "/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc
- uses: msys2/setup-msys2@v2.26.0
if: runner.os == 'Windows'
with:
msystem: MSYS
path-type: minimal
update: true
install: >-
base-devel
gcc
git
bc
python-pip
dosfstools
mingw-w64-x86_64-ccache
- name: Checkout
if: runner.os == 'Linux'
uses: actions/checkout@v4
- name: Install pip dependencies
run: pip install ${{ matrix.pip_option }} yamlish junit-xml
- name: Install openvpn
if: runner.os == 'Windows'
shell: pwsh
env:
file: "OpenVPN-2.6.14-I001-amd64.msi"
log: "install.log"
run: |
curl -L -O "https://swupdate.openvpn.org/community/releases/${{ env.file }}"
$procMain = Start-Process "msiexec" "/i ${{ env.file }} /qn /l*! ${{ env.log }}" -NoNewWindow -PassThru
$procLog = Start-Process "powershell" "Get-Content -Path ${{ env.log }} -Wait" -NoNewWindow -PassThru
$procMain.WaitForExit()
$procLog.Kill()
- name: Partial Clone
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
BRANCH="${GITHUB_REF/#refs\/heads\//}"
git init .
git remote add origin $REPO
git config core.sparseCheckout true
echo -e '/*\n!*aux.*' >> .git/info/sparse-checkout
git -c protocol.version=2 fetch --no-tags --prune --progress --depth=10 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH}
git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH
- uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-build-${{ github.sha }}
restore-keys: ${{ runner.os }}-ccache-build-
- name: Install ccache on ubuntu-latest
if: runner.os == 'Linux'
run: |
sudo apt update -y
sudo apt install -y ccache libjsmn-dev libfuse3-dev clang lld llvm qemu-system-x86 qemu-utils sshpass cloud-image-utils
- name: Install patched binutils for Windows
if: runner.os == 'Windows'
run: |
cp -f tools/lkl/bin/*.exe /usr/bin/
- name: Fix broken msys2 ccache
if: runner.os == 'Windows'
run: |
mkdir -p /usr/lib/ccache/bin
cd /usr/lib/ccache/bin
echo -e '#!/bin/bash\n\nccache /usr/bin/cc "$@"' > cc
echo -e '#!/bin/bash\n\nccache /usr/bin/gcc "$@"' > gcc
echo -e '#!/bin/bash\n\nccache /usr/bin/cpp "$@"' > cpp
export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:$PATH
which gcc
ccache -z
- name: install zpoline
if: matrix.displayTargetName == 'zpoline'
run: |
sudo apt install -y binutils-dev lib32gcc-s1
git clone https://github.com/yasukata/zpoline
cd zpoline
git checkout 022a3b8c7a5c23bfd99162b478bf3eb5f70c07a2
make
cd ..
# This is the whole point of zpoline
echo "==== setting mmap_min_addr ===="
sudo sh -c "echo 0 > /proc/sys/vm/mmap_min_addr"
echo "setting env variable (debug)"
echo "ZPOLINE_DEBUG=0" >> "$GITHUB_ENV"
- name: Start QEMU
if: matrix.displayTargetName == 'linux'
run: |
./tools/lkl/scripts/qemu-x86_64-make-images.sh
sudo chmod a+rw /dev/kvm
. tools/lkl/scripts/qemu-x86_64-start-and-set-env.sh
echo MYHOST="$HOST" >> $GITHUB_ENV
echo MYSSH="$MYSSH" >> $GITHUB_ENV
echo MYSCP="$MYSCP" >> $GITHUB_ENV
echo LKL_QEMU_TEST=1 >> $GITHUB_ENV
- name: Build
run: |
make -j4 -C tools/lkl ${{ matrix.build_options }}
- name: Tests
run: mkdir junit && make -C tools/lkl run-tests tests="--junit-dir ../../junit"
- name: Save test results
uses: actions/upload-artifact@v5
if: success() || failure()
with:
name: test-results-${{ matrix.displayTargetName }}
path: junit/*.xml
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v5
with:
name: Event File
path: ${{ github.event_path }}
checkpatch:
runs-on: ubuntu-24.04
name: checkpatch
steps:
- name: Checkout
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Install pip dependencies
run: sudo pip install ply GitPython
- name: Check coding style
run: tools/lkl/scripts/checkpatch.sh
fuzzers:
runs-on: ubuntu-22.04
name: fuzzers
env:
PROTOBUF_MUTATOR_DIR: /tmp/libprotobuf-mutator
steps:
- name: Checkout
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Install clang toolchain
run: |
sudo apt update -y
sudo apt install -y clang lld llvm
- name: Install libprotobuf-mutator prerequisites
run: |
sudo apt update -y
sudo apt install -y binutils cmake ninja-build liblzma-dev libz-dev \
pkg-config autoconf libtool
- name: Build libprotobuf-mutator
run: tools/lkl/scripts/libprotobuf-mutator-build.sh
- name: Build fuzzers
run: make -j4 -C tools/lkl LKL_FUZZING=1 MMU=1 fuzzers