forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 137
177 lines (168 loc) · 5.9 KB
/
ci.yml
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
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
tests:
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- displayTargetName: ubuntu-22.04
os: unix
runs_on: ubuntu-22.04
shell: bash
- displayTargetName: kasan
os: unix
runs_on: ubuntu-22.04
shell: bash
build_options: "kasan=yes kasan_test=yes"
- displayTargetName: windows-2019
os: windows
runs_on: windows-2019
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"
- displayTargetName: lkl-fuzzers
os: unix
runs_on: ubuntu-22.04
shell: bash
build_options: "LKL_FUZZING=1 fuzzers"
- displayTargetName: zpoline
# maybe integrate with default Linux build once the function becomes stable
os: unix
runs_on: ubuntu-22.04
shell: bash
build_options: "zpoline=./zpoline"
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
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@v2
- name: Install pip dependencies
run: pip install yamlish junit-xml
- name: Install openvpn
if: runner.os == 'Windows'
shell: pwsh
run: |
curl -L -O https://swupdate.openvpn.org/community/releases/OpenVPN-2.5.3-I601-amd64.msi
$file = "OpenVPN-2.5.3-I601-amd64.msi"
$log = "install.log"
$procMain = Start-Process "msiexec" "/i `"$file`" /qn /l*! `"$log`"" -NoNewWindow -PassThru
$procLog = Start-Process "powershell" "Get-Content -Path `"$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@v2
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
- name: Install clang toolchain
if: runner.os == 'Linux'
run: |
sudo apt update -y
sudo apt install -y clang lld llvm
- 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
git clone https://github.com/yasukata/zpoline
cd zpoline
# FIXME: this is needed for the moment to silence debug messages
# from zpoline. without that, our tests to verify console outputs won't pass.
git fetch origin pull/3/head:pr-3
git checkout pr-3
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: Build
run: |
make -j4 -C tools/lkl ${{ matrix.build_options }}
- name: Tests
run: mkdir /tmp/junit && make -C tools/lkl run-tests tests="--junit-dir /tmp/junit"
- name: Save test results
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: test-results-${{ matrix.displayTargetName }}
path: /tmp/junit/*.xml
checkpatch:
runs-on: ubuntu-20.04
name: checkpatch
steps:
- name: Checkout
with:
fetch-depth: 0
uses: actions/checkout@v2
- name: Install pip dependencies
run: sudo pip install ply GitPython
- name: Check coding style
run: tools/lkl/scripts/checkpatch.sh