Skip to content

Commit

Permalink
scx: Add CI action that builds schedulers for PRs
Browse files Browse the repository at this point in the history
When Ubuntu ships with sched_ext, we can also maybe test loading the
schedulers (not sure if the runners can run as root though). For now, we
should at least have a CI job that lets us verify that the schedulers
can _build_. To that end, this patch adds a basic CI action that builds
the schedulers.

As is, this is a bit brittle in that we're having to manually download
and install a few dependencies. I don't see a better way for now without
hosting our own runners with our own containers, but that's a bigger
investment. For now, hopefully this will get us _some_ coverage.

Signed-off-by: David Vernet <[email protected]>
  • Loading branch information
Byte-Lab committed Dec 18, 2023
1 parent 239d5d1 commit 78779f1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/build-scheds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build-scheds
run-name: ${{ github.actor }} PR run
on: [pull_request]
jobs:
build-schedulers:
runs-on: ubuntu-20.04
steps:

### DOWNLOAD AND INSTALL DEPENDENCIES ###

# Download dependencies packaged by Ubuntu
- run: sudo apt update
- run: sudo apt install -y cmake cargo elfutils libelf-dev linux-headers-generic ninja-build

# bpftool
- run: git clone --recurse-submodules --branch v7.3.0 https://github.com/libbpf/bpftool.git
- run: make -j -C bpftool/src
- run: make -j -C bpftool/src install

# zstd
- run: git clone --branch zstd-0.4.2 https://github.com/facebook/zstd.git
- run: make -j -C zstd install

# asm headers
- run: sudo ln -s /usr/include/asm-generic /usr/include/asm

# clang 17
- run: wget https://apt.llvm.org/llvm.sh
- run: chmod +x llvm.sh
- run: sudo ./llvm.sh all
- run: sudo apt install -y clang-17 lldb-17 lld-17
- run: ln -s /usr/bin/clang-17 /usr/bin/clang

- uses: actions/checkout@v4

# libbpf
- run: git clone --recurse-submodules --branch v1.3.0 https://github.com/libbpf/libbpf.git
- run: make -j -C libbpf/src
- run: make -j -C libbpf/src install

# meson
- run: pip install meson

### END DEPENDENCIES ###

# The actual build:
- run: meson setup build -Dlibbpf_a=`pwd`/libbpf/src/libbpf.a --prefix ~
- run: meson compile -C build
3 changes: 2 additions & 1 deletion scheds/c/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
c_scheds = ['scx_simple', 'scx_qmap', 'scx_central', 'scx_pair', 'scx_flatcg', 'scx_userland', 'scx_nest']

foreach sched: c_scheds
thread_dep = dependency('threads')
bpf_o = gen_bpf_o.process(sched + '.bpf.c', extra_args: bpf_includes)
bpf_skel = gen_bpf_skel.process(bpf_o)
executable(sched, [bpf_skel, sched + '.c'],
include_directories: [user_c_includes],
dependencies: libbpf_dep,
dependencies: [libbpf_dep, thread_dep],
install: true)
endforeach

0 comments on commit 78779f1

Please sign in to comment.