Skip to content

Build all kernel versions #245

Build all kernel versions

Build all kernel versions #245

Workflow file for this run

name: Build all kernel versions
on:
schedule:
- cron: '5 3 * * *'
push:
branches:
- staging
paths:
- .github/workflows/kernels.yml
- os/packages/linux/**
pull_request:
branches:
- staging
paths:
- .github/workflows/kernels.yml
- os/packages/linux/**
env:
NIX_PATH: nixpkgs=https://channels.nixos.org/nixos-25.11/nixexprs.tar.xz
jobs:
detect:
name: Detect available kernel versions
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
kernelVersions: ${{ steps.set.outputs.kernelVersions }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-25.11
- id: set
shell: bash
run: |
kernelVersions=$(nix-instantiate --eval --json --strict os/packages/linux/available-kernels.nix | jq -c '.kernels | keys')
echo "Detected available kernels: $kernelVersions"
echo "kernelVersions=$kernelVersions" >> "$GITHUB_OUTPUT"
build:
name: Kernel ${{ matrix.kernel }}
needs: detect
runs-on: self-hosted
strategy:
matrix:
kernel: ${{ fromJson(needs.detect.outputs.kernelVersions) }}
timeout-minutes: 480
steps:
- uses: actions/checkout@v4
- name: Determine branch name
id: vars
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Build toplevel closure with kernel ${{ matrix.kernel }}
run: |
cat <<'EOF' > os/configs/local.nix
{ config, ... }:
{
boot.kernelVersion = "${{ matrix.kernel }}";
system.systemBuilderCommands = ''
ln -sf ${config.boot.kernelPackage.dev} $out/kernel-dev
'';
}
EOF
make toplevel
echo "BUILD_OUT=$(readlink -f os/result/toplevel)" >> $GITHUB_ENV
rm -f os/configs/local.nix
- name: Copy toplevel closure with kernel ${{ matrix.kernel }} to binary cache
env:
VPSADMINOS_CACHE_SSH_KEY: ${{ secrets.VPSADMINOS_CACHE_SSH_KEY }}
run: |
install -m 600 -D <(echo "$VPSADMINOS_CACHE_SSH_KEY") .ssh/cache_id
NIX_SSHOPTS="-i .ssh/cache_id -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" nix-copy-closure --to [email protected] "$BUILD_OUT"
- name: Add new profile generation for kernel ${{ matrix.kernel }}
env:
BRANCH: ${{ steps.vars.outputs.branch }}-kernel-${{ matrix.kernel }}
run: |
ssh -i .ssh/cache_id \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
[email protected] \
sudo push-ci-generation "$BRANCH" "$BUILD_OUT"