Skip to content
Draft
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
43 changes: 43 additions & 0 deletions .github/workflows/build-scx-builder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build scx-builder
description: |
This workflow builds a ./build-scx-scheds/Dockerfile docker image,
which can be used for sched-ext build.
It is pushed to 'ghcr.io/libbpf/scx-builder'

on:
pull_request:
paths:
- 'build-scx-scheds/**'
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/scx-builder

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v6

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: build-scx-scheds
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
7 changes: 7 additions & 0 deletions build-scx-scheds/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:24.04

RUN apt-get update -y && apt-get install -y --no-install-recommends sudo

COPY install-dependencies.sh /tmp/install-dependencies.sh
RUN /tmp/install-dependencies.sh

16 changes: 16 additions & 0 deletions build-scx-scheds/action.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -xeuo pipefail

docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${GITHUB_ACTION_PATH}:/action" \
-v "${OUTPUT_DIR}:/output" \
-w /workspace \
-e OUTPUT_DIR=/output \
--entrypoint /action/build-scheds.sh \
ghcr.io/libbpf/scx-builder:latest

# Fixup ownership of output files
sudo chown -R "$(id -u):$(id -g)" "${OUTPUT_DIR}"

13 changes: 5 additions & 8 deletions build-scx-scheds/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ inputs:
required: true

runs:
using: "composite"
using: 'composite'
steps:

- name: Install sched-ext/scx dependencies
- name: Build sched-ext/scx in container
shell: bash
run: ${GITHUB_ACTION_PATH}/install-dependencies.sh

- name: Build sched-ext/scx
env:
GITHUB_ACTION_PATH: ${{ github.action_path }}
GITHUB_WORKSPACE: ${{ github.workspace }}
OUTPUT_DIR: ${{ inputs.output-dir }}
shell: bash
run: ${GITHUB_ACTION_PATH}/build-scheds.sh
run: ${{ github.action_path }}/action.sh
2 changes: 1 addition & 1 deletion build-scx-scheds/build-scheds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export SCX_ROOT=${SCX_ROOT:-}
export SCX_REVISION=${SCX_REVISION:-main}

if [[ -z "$SCX_ROOT" ]]; then
export SCX_ROOT=$(mktemp -d scx.XXXX)
export SCX_ROOT=$(mktemp -d /tmp/scx.XXXX)
git clone --branch=main https://github.com/sched-ext/scx.git $SCX_ROOT
pushd $SCX_ROOT
git reset --hard $SCX_REVISION
Expand Down
Loading