comodore-iec-emu/.gitea/workflows/build-kernel.yml
Christian Werner 1c5fe33927
Some checks failed
Build kernel module / build (1:6.12.93-1+rpt1) (push) Failing after 5m23s
Build kernel module / release (push) Has been skipped
feat(ci): Add support for parallel kernel module builds
Enable parallel builds for kernel modules targeting multiple kernel
headers. This optimization reduces build times and improves CI
efficiency. Adjusted workflow steps to ensure compatibility with all
supported environments.
2026-06-19 03:25:53 +02:00

94 lines
3.3 KiB
YAML

name: Build kernel module
on:
# Release flow: triggered when a version tag is pushed (tag a commit on master).
# Builds every target and publishes the modules to a Gitea release.
push:
tags:
- 'v*'
# Compile-check flow: every PR that targets master. Builds only, no release.
pull_request:
branches:
- master
jobs:
# Build (and thereby compile-check) the module for each pinned kernel version.
# Runs on both triggers — on a PR this is the whole story; on a tag the
# `release` job below consumes the artifacts.
#
# HEADERS_PKG is fixed to linux-headers-rpi-v8 (64-bit, Pi Zero 2 W): the -v6/-v7
# headers are 32-bit (armhf) and aren't carried by the arm64 raspberrypi archive
# this arm64 builder uses.
build:
runs-on: ubuntu-latest
env:
HEADERS_PKG: linux-headers-rpi-v8
strategy:
# Don't cancel the other versions if one fails to build.
fail-fast: false
matrix:
kernel_version:
- "1:6.12.93-1+rpt1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build module (${{ matrix.kernel_version }})
working-directory: kernel
env:
HEADERS_PKG: ${{ env.HEADERS_PKG }}
KERNEL_VERSION: ${{ matrix.kernel_version }}
run: ./build-in-docker.sh
- name: Stage build output (modules/iec_listener_<kernel_version>.ko)
working-directory: kernel
run: |
ver="${{ matrix.kernel_version }}"
safe="${ver//[:\/]/-}" # path-friendly: 1:6.12.93-1+rpt1 -> 1-6.12.93-1+rpt1
echo "kernel version $ver -> file modules/iec_listener_${safe}.ko"
mkdir -p out/modules
mv iec_listener.ko "out/modules/iec_listener_${safe}.ko"
- name: Upload build output
uses: actions/upload-artifact@v4
with:
# Name by the path-friendly version so artifact names stay unique; all
# of them merge back into the single modules/ folder at download time.
name: ${{ matrix.kernel_version }}
path: kernel/out
if-no-files-found: error
# Release flow only: merges all built modules into one modules/ folder, wraps it
# in a single repo-named top folder alongside selftest.sh, zips it and attaches
# it to the Gitea release for the pushed tag. Skipped entirely on pull requests.
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all build output
uses: actions/download-artifact@v4
with:
path: dist
# Merge every artifact back into the shared modules/ folder.
merge-multiple: true
- name: Assemble release package
run: |
repo="${{ github.event.repository.name }}"
root="package/$repo"
mkdir -p "$root"
cp -r dist/modules "$root"/ # modules/iec_listener_<kernel_version>.ko
cp kernel/selftest.sh "$root"/ # selftest.sh only at the package root
(cd package && zip -r "../${repo}-${{ github.ref_name }}.zip" "$repo")
- name: Publish to Gitea release
uses: actions/gitea-release-action@v1.3.6
with:
api_key: ${{ secrets.GITEA_TOKEN }}
files: |-
*.zip