forked from sched-ext/scx
-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (198 loc) · 8.7 KB
/
caching-build.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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: caching-build
on:
push:
jobs:
build-kernel:
if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo')
runs-on: ubuntu-24.04
steps:
# redundancy to exit fast
- run: echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
- run: sudo apt update
- run: sudo apt install -y git --no-install-recommends
# get latest head commit of sched_ext for-next
- run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV
- uses: actions/checkout@v4
# use cached kernel if available, create after job if not
- name: Cache Kernel
id: cache-kernel
uses: actions/cache@v4
with:
path: |
linux
key: kernel-build-${{ env.SCHED_EXT_KERNEL_COMMIT }}
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
uses: ./.github/actions/install-deps-action
# cache virtiofsd (goes away w/ 24.04)
- name: Cache virtiofsd
id: cache-virtiofsd
uses: actions/cache@v4
with:
path: |
/usr/lib/virtiofsd
key: virtiofsd-binary
- if: ${{ steps.cache-virtiofsd.outputs.cache-hit != 'true' && steps.cache-kernel.outputs.cache-hit != 'true' }}
run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/
# cache bzImage alone for rust tests (disk space limit workaround)
- name: Cache bzImage
id: cache-bzImage
uses: actions/cache@v4
with:
path: |
linux/arch/x86/boot/bzImage
key: kernel-bzImage-${{ env.SCHED_EXT_KERNEL_COMMIT }}
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
name: Clone Kernel
# Get the latest sched-ext enabled kernel directly from the korg
# for-next branch
run: git clone --single-branch -b sched_ext https://github.com/sched-ext/sched_ext.git linux && cd linux && git checkout ${{ env.SCHED_EXT_KERNEL_COMMIT }}
# guard rail because we are caching
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
run: cd linux && git checkout ${{ env.SCHED_EXT_KERNEL_COMMIT }}
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
# Print the latest commit of the checked out sched-ext kernel
run: cd linux && git log -1 --pretty=format:"%h %ad %s" --date=short
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
# Build a minimal kernel (with sched-ext enabled) using virtme-ng
run: cd linux && find . -type f -exec sed -i 's/-Werror/-Wno-error/g' {} \; && vng -v --build --config ../.github/workflows/sched-ext.config
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
# Generate kernel headers
run: cd linux && make headers
integration-test:
if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo')
runs-on: ubuntu-24.04
needs: build-kernel
strategy:
matrix:
scheduler: [ scx_layered, scx_rusty ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-deps-action
# cache virtiofsd (goes away w/ 24.04)
- name: Cache virtiofsd
id: cache-virtiofsd
uses: actions/cache@v4
with:
path: |
/usr/lib/virtiofsd
key: virtiofsd-binary
- if: ${{ steps.cache-virtiofsd.outputs.cache-hit != 'true' }}
run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/
# get latest head commit of sched_ext for-next
- run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV
# use cached kernel if available, create after job if not
- name: Cache Kernel
id: cache-kernel
uses: actions/cache@v4
with:
path: |
linux
key: kernel-build-${{ env.SCHED_EXT_KERNEL_COMMIT }}
# need to re-run job when kernel head changes between build and test running.
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }}
name: exit if cache stale
run: exit -1
# veristat
- run: wget https://github.com/libbpf/veristat/releases/download/v0.3.2/veristat-v0.3.2-amd64.tar.gz
- run: tar -xvf veristat-v0.3.2-amd64.tar.gz && sudo cp veristat /usr/bin/
- run: sudo chmod +x /usr/bin/veristat && sudo chmod 755 /usr/bin/veristat
# The actual build:
- run: meson setup build -Dkernel=$(pwd)/linux -Dkernel_headers=./linux/usr/include -Denable_stress=true
- run: meson compile -C build ${{ matrix.scheduler }}
# Print CPU model before running the tests (this can be useful for
# debugging purposes)
- run: grep 'model name' /proc/cpuinfo | head -1
# Test schedulers
- run: meson compile -C build test_sched_${{ matrix.scheduler }}
# Stress schedulers
- uses: cytopia/[email protected]
name: stress test
with:
retries: 3
command: meson compile -C build stress_tests_${{ matrix.scheduler }}
- run: meson compile -C build veristat_${{ matrix.scheduler }}
rust-test-core:
if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo')
runs-on: ubuntu-24.04
needs: build-kernel
strategy:
matrix:
component: [scx_loader, scx_rustland_core, scx_stats, scx_utils]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-deps-action
# cache virtiofsd (goes away w/ 24.04)
- name: Cache virtiofsd
id: cache-virtiofsd
uses: actions/cache@v4
with:
path: |
/usr/lib/virtiofsd
key: virtiofsd-binary
- if: ${{ steps.cache-virtiofsd.outputs.cache-hit != 'true' }}
run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/
# get latest head commit of sched_ext for-next
- run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV
# cache bzImage alone for rust tests
- name: Cache bzImage
id: cache-bzImage
uses: actions/cache@v4
with:
path: |
linux/arch/x86/boot/bzImage
key: kernel-bzImage-${{ env.SCHED_EXT_KERNEL_COMMIT }}
# need to re-run job when kernel head changes between build and test running.
- if: ${{ steps.cache-bzImage.outputs.cache-hit != 'true' }}
name: exit if cache stale
run: exit -1
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
key: ${{ matrix.component }}
prefix-key: "1"
- run: cargo build --manifest-path rust/${{ matrix.component }}/Cargo.toml
- run: cargo test --manifest-path rust/${{ matrix.component }}/Cargo.toml --no-run
- run: vng -v --memory 10G --cpu 8 -r linux/arch/x86/boot/bzImage --net user -- cargo test --manifest-path rust/${{ matrix.component }}/Cargo.toml
rust-test-schedulers:
if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo')
runs-on: ubuntu-24.04
needs: build-kernel
strategy:
matrix:
scheduler: [ scx_layered, scx_rusty ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-deps-action
# cache virtiofsd (goes away w/ 24.04)
- name: Cache virtiofsd
id: cache-virtiofsd
uses: actions/cache@v4
with:
path: |
/usr/lib/virtiofsd
key: virtiofsd-binary
- if: ${{ steps.cache-virtiofsd.outputs.cache-hit != 'true' }}
run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/
# get latest head commit of sched_ext for-next
- run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV
# cache bzImage alone for rust tests
- name: Cache bzImage
id: cache-bzImage
uses: actions/cache@v4
with:
path: |
linux/arch/x86/boot/bzImage
key: kernel-bzImage-${{ env.SCHED_EXT_KERNEL_COMMIT }}
# need to re-run job when kernel head changes between build and test running.
- if: ${{ steps.cache-bzImage.outputs.cache-hit != 'true' }}
name: exit if cache stale
run: exit -1
- uses: Swatinem/rust-cache@v2
with:
workspaces: scheds/rust
key: ${{ matrix.scheduler }}
prefix-key: "1"
- run: cargo build --manifest-path scheds/rust/${{ matrix.scheduler }}/Cargo.toml
- run: cargo test --manifest-path scheds/rust/${{ matrix.scheduler }}/Cargo.toml --no-run
- run: vng -v --memory 10G --cpu 8 -r linux/arch/x86/boot/bzImage --net user -- cargo test --manifest-path scheds/rust/${{ matrix.scheduler }}/Cargo.toml