From: Thomas Weißschuh Date: Fri, 19 May 2023 09:38:18 +0000 (+0200) Subject: ci: add OpenWrt SDK based CI jobs X-Git-Tag: v2.40-rc1~448^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f7c4093e2ff5fc79e70036d9db9b24e7c54c8c3;p=thirdparty%2Futil-linux.git ci: add OpenWrt SDK based CI jobs This allows testing some more exotic architectures and libcs. Signed-off-by: Thomas Weißschuh --- diff --git a/.github/workflows/cibuild-setup-ubuntu.sh b/.github/workflows/cibuild-setup-ubuntu.sh index de9f8a85c5..89780b4649 100755 --- a/.github/workflows/cibuild-setup-ubuntu.sh +++ b/.github/workflows/cibuild-setup-ubuntu.sh @@ -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 - PACKAGES+=("$COMPILER") + 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 diff --git a/.github/workflows/cibuild.sh b/.github/workflows/cibuild.sh index 9c1ed5494e..909126f48a 100755 --- a/.github/workflows/cibuild.sh +++ b/.github/workflows/cibuild.sh @@ -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 diff --git a/.github/workflows/cibuild.yml b/.github/workflows/cibuild.yml index 4372e05cce..236083d5b1 100644 --- a/.github/workflows/cibuild.yml +++ b/.github/workflows/cibuild.yml @@ -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 diff --git a/.github/workflows/openwrt-sdk-env.sh b/.github/workflows/openwrt-sdk-env.sh new file mode 100755 index 0000000000..c3d618decf --- /dev/null +++ b/.github/workflows/openwrt-sdk-env.sh @@ -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