Builds #2
This file contains hidden or 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: Builds | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| kernel_version: | |
| description: > | |
| Exact kernel version to build, e.g. 6.19.4 or 7.1.0-rc2. No | |
| reference config is required for this -- genconfig.sh only needs | |
| one if you also turn on "validate" below. | |
| required: true | |
| type: string | |
| flavor: | |
| description: "Which flavor to build the .deb for." | |
| required: false | |
| default: generic | |
| type: choice | |
| options: | |
| - generic | |
| - incus-os | |
| validate: | |
| description: > | |
| Also compare the generated config against misc/<series>/zabbly-config | |
| for this kernel's series, purely informational (shown in the job | |
| summary). Off by default: a reference isn't needed to build a .deb, | |
| only to check fidelity against it, and this lets you package a | |
| kernel series that has no reference config yet. Turning this on | |
| fails the run if that series has no reference. | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-kernel: | |
| name: Build kernel | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - debian-13 | |
| arch: | |
| - amd64 | |
| runs-on: | |
| - self-hosted | |
| - zabbly-kernel-build | |
| - arch-${{ matrix.arch }} | |
| - image-${{ matrix.os }} | |
| env: | |
| FLAVOR: ${{ inputs.flavor }} | |
| KERNEL_VERSION: ${{ inputs.kernel_version }} | |
| VALIDATE: ${{ inputs.validate }} | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Determine kernel series | |
| run: | | |
| set -euo pipefail | |
| series="$(echo "${KERNEL_VERSION%%-*}" | cut -d. -f1,2)" | |
| echo "series=$series" >> "$GITHUB_ENV" | |
| echo "Kernel series: $series" | |
| - name: Cache kernel source tree | |
| id: kernel-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/kernel/linux-${{ inputs.kernel_version }} | |
| key: linux-src-${{ inputs.kernel_version }} | |
| - name: Download kernel source tree | |
| if: steps.kernel-cache.outputs.cache-hit != 'true' | |
| run: | | |
| set -euo pipefail | |
| major="${KERNEL_VERSION%%.*}" | |
| url="https://cdn.kernel.org/pub/linux/kernel/v${major}.x/linux-${KERNEL_VERSION}.tar.xz" | |
| mkdir -p ~/kernel | |
| echo "Fetching $url" | |
| curl -fSL --retry 3 "$url" | tar -xJ -C ~/kernel | |
| test -f ~/kernel/linux-"$KERNEL_VERSION"/Makefile | |
| - name: Create .env | |
| run: | | |
| set -euo pipefail | |
| sed -e "s|^KERNEL_TREE_PATH=.*|KERNEL_TREE_PATH=/kernel/linux-${KERNEL_VERSION}|" \ | |
| -e "s|^KERNEL_TREE_BUILD_PATH=.*|KERNEL_TREE_BUILD_PATH=/kbuild|" \ | |
| .env.example > .env | |
| cat .env | |
| - name: Generate kernel config | |
| run: | | |
| ./check_slices.py "$FLAVOR" | |
| if [ "$VALIDATE" = "true" ]; then | |
| ./genconfig.sh "$FLAVOR" --normalize --validate | |
| else | |
| ./genconfig.sh "$FLAVOR" --normalize --no-validate | |
| fi | |
| source .env | |
| if [ "$FLAVOR" != "generic" ]; then | |
| GENERATED_CONFIG_PATH="${GENERATED_CONFIG_PATH}-${FLAVOR}" | |
| fi | |
| cp "$GENERATED_CONFIG_PATH" "${KERNEL_TREE_BUILD_PATH}/.config" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --yes \ | |
| bc \ | |
| binutils \ | |
| bison \ | |
| cpio \ | |
| debhelper \ | |
| dpkg-dev \ | |
| flex \ | |
| git \ | |
| kmod \ | |
| libdw-dev \ | |
| libelf-dev \ | |
| libssl-dev \ | |
| rsync \ | |
| zstd | |
| sudo apt-get install --yes pahole || true | |
| - name: Configure git | |
| run: | | |
| git config user.email "noreply@futurfusion.io" | |
| git config user.name "FuturFusion kernel build" | |
| - name: Generate version string | |
| env: | |
| PKGARCH: "${{ matrix.arch }}" | |
| PKGOS: "${{ matrix.os }}" | |
| run: | | |
| source .env | |
| VERSION="$(make -C "$KERNEL_TREE_PATH" kernelversion)-${PKGARCH}-$(date -u +%Y%m%d%H%M)-$(echo ${PKGOS} | sed "s/-//g")" | |
| echo "${VERSION}" | |
| echo "${VERSION}" > ../.version | |
| - name: Build the kernel | |
| env: | |
| DEBEMAIL: "info@futurfusion.io" | |
| DEBFULLNAME: "FuturFusion Kernel Builds" | |
| KDEB_CHANGELOG_DIST: "${{ matrix.os }}" | |
| KDEB_COMPRESS: "zstd" | |
| PKGOS: "${{ matrix.os }}" | |
| run: | | |
| export KDEB_PKGVERSION="$(cat ../.version)" | |
| export KDEB_SOURCENAME="linux-ff-${KDEB_PKGVERSION}" | |
| make -C "$KERNEL_TREE_PATH" O="$KERNEL_TREE_BUILD_PATH" deb-pkg -j16 || | |
| make -C "$KERNEL_TREE_PATH" O="$KERNEL_TREE_BUILD_PATH" deb-pkg -j16 | |
| - name: Prepare the artifacts | |
| run: | | |
| mkdir out/ | |
| mv "${KERNEL_TREE_BUILD_PATH}/../linux-*" out/ | |
| - name: Upload resulting build | |
| uses: actions/upload-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| name: ${{ matrix.os }}-${{ matrix.arch }} | |
| path: out/* |