ci: add OpenWrt SDK based CI jobs

This allows testing some more exotic architectures and libcs.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
This commit is contained in:
Thomas Weißschuh 2023-05-19 11:38:18 +02:00
parent 9b1cf2bc69
commit 5f7c4093e2
4 changed files with 72 additions and 1 deletions

View file

@ -58,7 +58,9 @@ bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ $RELEASE main restricte
# cov-build fails to compile util-linux when CC is set to gcc-*
# so let's just install and use the default compiler
if [[ "$COMPILER_VERSION" == "" ]]; then
if [[ "$COMPILER" != "none" ]]; then
PACKAGES+=("$COMPILER")
fi
elif [[ "$COMPILER" == clang ]]; then
# Latest LLVM stack deb packages provided by https://apt.llvm.org/
# Following snippet was borrowed from https://apt.llvm.org/llvm.sh

View file

@ -104,6 +104,10 @@ for phase in "${PHASES[@]}"; do
CXXFLAGS+=(-shared-libasan)
fi
if [[ "$HOST_TRIPLET" != "" ]]; then
opts+=(--host "$HOST_TRIPLET")
fi
git clean -xdf
./autogen.sh

View file

@ -133,3 +133,51 @@ jobs:
.github/workflows/cibuild.sh CONFIGURE MAKE
# Check
.github/workflows/cibuild.sh CHECK
build-openwrt:
name: build (openwrt, ${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: ipq40xx
subtarget: generic
abi: musl_eabi
- target: ath79
subtarget: generic
abi: musl
- target: bcm63xx
subtarget: generic
abi: musl
- target: mpc85xx
subtarget: p2020
abi: musl
- target: archs38
subtarget: generic
abi: glibc
env:
COMPILER: none
steps:
- name: Repository checkout
uses: actions/checkout@v1
- name: Ubuntu setup
run: sudo -E .github/workflows/cibuild-setup-ubuntu.sh
- name: OpenWrt environment
run: |
OPENWRT_RELEASE=22.03.5
OPENWRT_SDK=openwrt-sdk-$OPENWRT_RELEASE-${{ matrix.target }}-${{ matrix.subtarget }}_gcc-11.2.0_${{ matrix.abi }}.Linux-x86_64
echo "COMPILER=$COMPILER" >> $GITHUB_ENV
echo "OPENWRT_RELEASE=$OPENWRT_RELEASE" >> $GITHUB_ENV
echo "OPENWRT_SDK=$OPENWRT_SDK" >> $GITHUB_ENV
- name: Download toolchain
run: |
curl -o ~/${{ env.OPENWRT_SDK }}.tar.xz -C - https://downloads.cdn.openwrt.org/releases/${{ env.OPENWRT_RELEASE }}/targets/${{ matrix.target }}/${{ matrix.subtarget }}/${{ env.OPENWRT_SDK }}.tar.xz
tar xf ~/${{ env.OPENWRT_SDK }}.tar.xz -C ~
- name: Configure
run: |
source .github/workflows/openwrt-sdk-env.sh ~/${{ env.OPENWRT_SDK }}
.github/workflows/cibuild.sh CONFIGURE
- name: Make
run: |
source .github/workflows/openwrt-sdk-env.sh ~/${{ env.OPENWRT_SDK }}
.github/workflows/cibuild.sh MAKE

17
.github/workflows/openwrt-sdk-env.sh vendored Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
sdk="$(realpath $1)"
STAGING_DIR="$(echo "$sdk"/staging_dir/toolchain-*)"
. "$STAGING_DIR/info.mk"
PATH="$sdk/staging_dir/host/bin:$PATH"
CC="$STAGING_DIR/bin/${TARGET_CROSS}gcc"
BISON_PKGDATADIR="$sdk/staging_dir/host/share/bison"
M4="$sdk/staging_dir/host/bin/m4"
HOST_TRIPLET="$("$CC" -dumpmachine)"
echo "Building for $HOST_TRIPLET from $sdk"
export STAGING_DIR PATH CC BISON_PKGDATADIR M4 HOST_TRIPLET