Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/include/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
pyproject = false;
dontUnpack = true;

propagatedBuildInputs = with pkgs; [ cargo ];

installPhase = "install -Dm755 ${./list-integration-tests.py} $out/bin/list-integration-tests";
};

Expand Down
47 changes: 42 additions & 5 deletions .github/include/list-integration-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@
import sys


def get_package_kernel_requirements():
"""Get list of Rust crates with specific kernel requirements"""
result = subprocess.run(
["cargo", "metadata", "--format-version", "1"],
check=True,
capture_output=True,
text=True,
)
metadata = json.loads(result.stdout)

kernel_requirements = {}
for pkg in metadata.get("packages", []):
pkg_metadata = pkg.get("metadata")
if not pkg_metadata:
continue
scx_metadata = pkg_metadata.get("scx")
if not scx_metadata:
continue
ci_metadata = scx_metadata.get("ci")
if not ci_metadata:
continue
kernel_metadata = ci_metadata.get("kernel")
if not kernel_metadata:
continue
kernel_requirements[pkg["name"]] = kernel_metadata

return kernel_requirements


def get_kernel_trailers_from_commits():
"""Get CI-Test-Kernel trailers from commits between current HEAD and base branch."""
# In GitHub Actions, GITHUB_BASE_REF contains the target branch name for PRs
Expand Down Expand Up @@ -82,13 +111,14 @@ def main():

default_kernel = sys.argv[1]

kernel_reqs = get_package_kernel_requirements()

trailer_kernels = get_kernel_trailers_from_commits()

kernels_to_test = {default_kernel}
kernels_to_test.update(trailer_kernels)

matrix = []

for kernel in kernels_to_test:
# use a blank kernel name for the default, as the common case is to have
# no trailers and it makes the matrix names harder to read.
Expand All @@ -98,16 +128,23 @@ def main():
"scx_bpfland",
"scx_chaos",
"scx_lavd",
"scx_p2dq",
"scx_rlfifo",
"scx_rustland",
"scx_rusty",
"scx_tickless",
]:
matrix.append({"name": scheduler, "flags": "", "kernel": kernel_name})
reqs = kernel_reqs.get(scheduler, {})
allowlist = reqs.get("allowlist", [])
blocklist = reqs.get("blocklist", [])
if kernel in blocklist:
continue
# always allow the default kernel through, crates should specify
# kernel.default if they want a different one
if kernel != "" and allowlist and kernel not in allowlist:
continue

# p2dq fails on 6.12, see https://github.com/sched-ext/scx/issues/2075 for more info
if kernel != "stable/6_12":
matrix.append({"name": "scx_p2dq", "flags": "", "kernel": kernel_name})
matrix.append({"name": scheduler, "flags": "", "kernel": kernel_name})

for flags in itertools.product(
["--disable-topology=false", "--disable-topology=true"],
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/caching-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ jobs:
uses: ./.github/workflows/integration-tests.yml
needs: build-kernels
secrets: inherit
with:
repo-name: sched_ext/for-next

pages:
runs-on: ubuntu-24.04
Expand Down
32 changes: 21 additions & 11 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
workflow_call:
inputs:
repo-name:
required: true
type: string

jobs:
Expand Down Expand Up @@ -42,16 +41,6 @@ jobs:
with:
cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Load kernel
run: |
if [ -n "${{ matrix.scheduler.kernel }}" ]; then
KERNEL_NAME="${{ matrix.scheduler.kernel }}"
else
KERNEL_NAME="${{ inputs.repo-name }}"
fi
echo "KERNEL_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}")" >> $GITHUB_ENV
echo "KERNEL_HEADERS_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}".headers)" >> $GITHUB_ENV

- name: Install Veristat
run: nix-env -i $(nix build --no-link --print-out-paths ./.github/include#veristat)

Expand All @@ -63,6 +52,27 @@ jobs:
key: ${{ matrix.scheduler.name }}
prefix-key: "4"
- uses: ./.github/actions/install-deps-action

- name: Load kernel
run: |
if [ -n "${{ matrix.scheduler.kernel }}" ]; then
KERNEL_NAME="${{ matrix.scheduler.kernel }}"
elif [ -n "${{ inputs.repo-name }}" ]; then
KERNEL_NAME="${{ inputs.repo-name }}"
else
KERNEL_NAME=$(cargo metadata --format-version 1 --no-deps \
| jq -r --arg pkg "${{ matrix.scheduler.name }}" '
.packages[]?
| select(.name == $pkg)
| .metadata.scx?.ci?.kernel?.default
// "sched_ext/for-next"
')
fi

echo "KERNEL_NAME=$KERNEL_NAME" >> $GITHUB_ENV
echo "KERNEL_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}")" >> $GITHUB_ENV
echo "KERNEL_HEADERS_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}".headers)" >> $GITHUB_ENV

# cache virtiofsd (goes away w/ 24.04)
- name: Cache virtiofsd
id: cache-virtiofsd
Expand Down
3 changes: 3 additions & 0 deletions scheds/rust/scx_chaos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ license = "GPL-2.0-only"
[package.metadata.scx]
ci.use_clippy = true

ci.kernel.default = "stable/linux-rolling-stable"
ci.kernel.blocklist = ["sched_ext/for-next"]

[dependencies]
scx_userspace_arena = { path = "../../../rust/scx_userspace_arena", version = "1.0.13" }
scx_utils = { path = "../../../rust/scx_utils", version = "1.0.16" }
Expand Down
3 changes: 3 additions & 0 deletions scheds/rust/scx_p2dq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ edition = "2021"
description = "scx_p2dq A simple pick two load balancing scheduler in BPF"
license = "GPL-2.0-only"

[package.metadata.scx]
ci.kernel.blocklist = ["stable/6_12"]

[dependencies]
anyhow = "1.0.65"
chrono = "0.4"
Expand Down
Loading