build-and-test #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: caching-build | |
on: | |
# only runs on main, hourly cache update used by all branches | |
schedule: | |
- cron: "0 * * * *" | |
push: | |
jobs: | |
build-kernel: | |
runs-on: ubuntu-22.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=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $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: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | |
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | |
uses: ./.github/actions/install-deps-action | |
# 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: ${{ 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 for-next --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git linux | |
# 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 && 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: | |
runs-on: ubuntu-22.04 | |
needs: build-kernel | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-deps-action | |
# cache rust deps, invalidate when kernel commit changes | |
# get latest head commit of sched_ext for-next | |
- run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $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: ${{ 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 | |
# 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 | |
# Stress schedulers | |
- run: meson compile -C build stress_tests | |
- run: meson compile -C build veristat | |
rust-test: | |
runs-on: ubuntu-22.04 | |
needs: build-kernel | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-deps-action | |
# cache rust deps, invalidate when kernel commit changes | |
# get latest head commit of sched_ext for-next | |
- run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $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: ${{ 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: | |
shared-key: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | |
workspaces: rust | |
prefix-key: "1" | |
- run: cargo build --manifest-path rust/Cargo.toml | |
- run: cargo test --manifest-path rust/Cargo.toml --no-run | |
- run: vng -v -m10G -c8 --force-9p -r linux/arch/x86/boot/bzImage --net user -- cargo test --manifest-path rust/Cargo.toml |