Skip to content

CI: add workflow building a project as its SDK package - #148

Open
dangowrt wants to merge 1 commit into
openwrt:mainfrom
dangowrt:sdk-package-build
Open

dangowrt wants to merge 1 commit into
openwrt:mainfrom
dangowrt:sdk-package-build

Conversation

@dangowrt

Copy link
Copy Markdown
Member

This adds a reusable workflow, sdk-package-build.yml, that builds the calling project as its OpenWrt package inside ghcr.io/openwrt/sdk:<arch>-<branch> for a list of architectures, with the checkout as the package source. It publishes the built packages as artifacts, writes a size table to the job summary and uploads the build logs on failure.

openwrt/odhcpd, libubox, ubus, uci, libnl-tiny and odhcp6c each carry a copy of the same build matrix, which installs the cross compilers of the runner's distribution. Ubuntu 26.04 ships no MIPS cross compilers (gcc-mips-linux-gnu and gcc-mips64-linux-gnuabi64 are in 24.04 and absent from 26.04), so those jobs fail now that ubuntu-latest is 26.04. Building with the SDK uses OpenWrt's own toolchains and C library and needs nothing from the runner beyond Docker. The build script is the one openwrt/procd already uses in its build.yml, with the package name, package list and feed turned into parameters.

A caller needs only this:

jobs:
  sdk:
    uses: openwrt/actions-shared-workflows/.github/workflows/sdk-package-build.yml@main
    with:
      package: odhcpd
      packages: odhcpd odhcpd-ipv6only

Optional inputs are feed (default base), archs (a JSON array, default x86_64, i386_pentium4, aarch64_generic, arm_cortex-a15_neon-vfpv4, mips_24kc, mipsel_24kc, powerpc_8548, riscv64_generic) and sdk_branch (default master).

Tested by running sdk_package_build.sh locally in ghcr.io/openwrt/sdk:x86_64-master against a checkout of odhcpd master: both odhcpd and odhcpd-ipv6only built, versioned with the checkout's commit. The workflow file itself has not run on GitHub yet; openwrt/odhcpd will be its first caller.

LLM use: the workflow and the generalised script were written with the help of an LLM coding assistant and reviewed by me.

Projects such as odhcpd, libubox, ubus and uci build themselves in CI
with the cross compilers of the runner's distribution. Ubuntu 26.04
ships no MIPS cross compilers, so those jobs fail on ubuntu-latest.

Add a reusable workflow that builds the calling project as its OpenWrt
package inside the SDK container of each architecture, with the
checkout as the package source. The caller names the source package,
the binary packages to build and optionally the feed, the architectures
and the SDK branch. The job publishes the built packages, a size table
and, on failure, the build logs.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant