From 40f4b04bb26d2bc810c143af0011baa3c0c9b099 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 29 Jan 2023 18:51:26 +0000 Subject: [PATCH] Add quicker OpenWrt build to regular builds. Use the upstream build environment to speed up the compiling of OpenWrt ipk packages. (And minor doc updates after running this. --- .github/workflows/tests.yml | 80 ++++++++++++++++++++++++++++++++++ .gitignore | 18 +++++++- packages/openwrt/README.md | 7 ++- packages/openwrt/config.bthh5a | 11 +++++ packages/openwrt/config.n2n | 7 +++ packages/openwrt/config.x86 | 5 +++ 6 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 packages/openwrt/config.bthh5a create mode 100644 packages/openwrt/config.n2n create mode 100644 packages/openwrt/config.x86 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6f68a26..47be1ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -404,6 +404,84 @@ jobs: name: packages-rpm path: rpmbuild/RPMS/x86_64/*.rpm + package_ipk: + name: Package for OpenWrt + needs: + - test_linux + runs-on: ubuntu-latest + + strategy: + fail-fast: true + matrix: + include: + - name: bthh5a + sdk: https://downloads.openwrt.org/releases/22.03.3/targets/lantiq/xrx200/openwrt-sdk-22.03.3-lantiq-xrx200_gcc-11.2.0_musl.Linux-x86_64.tar.xz + - name: x86 + sdk: https://downloads.openwrt.org/releases/22.03.3/targets/x86/generic/openwrt-sdk-22.03.3-x86-generic_gcc-11.2.0_musl.Linux-x86_64.tar.xz + + defaults: + run: + working-directory: openwrt + + steps: + - name: Get sdk + run: | + wget ${{ matrix.sdk }} -O openwrt-sdk.tar.xz + tar xf openwrt-sdk.tar.xz + mv openwrt-sdk-* openwrt + working-directory: ./ + + - name: Checkout n2n + uses: actions/checkout@v3 + with: + path: n2n + fetch-depth: 0 + + - name: Fix Checkout + run: | + git fetch --force --tags + working-directory: n2n + + - name: Copy n2n package definition into openwrt + run: | + cp -r n2n/packages/openwrt openwrt/package/n2n + working-directory: ./ + + - name: Configure OpenWrt + run: | + make defconfig + + - name: Build n2n openwrt packages + run: | + export N2N_PKG_VERSION=$(../n2n/scripts/version.sh) + echo "Build for $N2N_PKG_VERSION" + make package/n2n/clean V=s + make package/n2n/prepare USE_SOURCE_DIR=$GITHUB_WORKSPACE/n2n V=s + make package/n2n/compile V=s + +# FIXME: add a way to run the test suite! +# - name: Run embedded tests +# run: make test + + - name: Save config used + if: always() + run: | + cp openwrt/.config config.${{ matrix.name }} + working-directory: ./ + + - name: Upload config file used for build + if: always() + uses: actions/upload-artifact@v3 + with: + name: openwrt-config + path: config.* + + - name: Upload ipk + uses: actions/upload-artifact@v3 + with: + name: packages-ipk + path: openwrt/bin/packages/*/base/*.ipk + binaries_windows: name: Binaries for Windows (x86_64-pc-mingw64) needs: @@ -605,6 +683,7 @@ jobs: needs: - package_dpkg - package_rpm + - package_ipk - binaries_windows - binaries_macos - binaries_macos_universal @@ -643,3 +722,4 @@ jobs: files: | artifacts/packages-dpkg/*.deb artifacts/packages-rpm/*.rpm + artifacts/packages-ipk/*/base/*.pkg diff --git a/.gitignore b/.gitignore index 8c25bfe..9f436b7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,11 @@ *.a *.gz configure -config.* +config.log +config.rpath +config.status +include/config.h +include/config.h.in /Makefile tools/Makefile autom4te.cache @@ -53,3 +57,15 @@ coverage/ *.indent *.unc-backup.md5~ *.unc-backup~ + +# Empty files created by the openwrt build +/.built +/.built_check +/.configured_* +/.prepared +/.quilt_checked +/.source_dir +/ABOUT-NLS +/AUTHORS +/ChangeLog +/NEWS diff --git a/packages/openwrt/README.md b/packages/openwrt/README.md index 65eac51..4d3a04f 100644 --- a/packages/openwrt/README.md +++ b/packages/openwrt/README.md @@ -36,13 +36,16 @@ the n2n repository. git clone https://github.com/ntop/n2n n2n N2N_PKG_VERSION=$(n2n/scripts/version.sh) export N2N_PKG_VERSION +echo $N2N_PKG_VERSION cp -r n2n/packages/openwrt openwrt/package/n2n cd openwrt -make menuconfig # select Network -> VPN -> n2n-edge and n2n-supernode +make oldconfig +# In the VPN section, select "m" for n2n-edge and n2n-supernode + make package/n2n/clean V=s -make package/n2n/prepare USE_SOURCE_DIR=../n2n V=s +make package/n2n/prepare USE_SOURCE_DIR=$(realpath ../n2n) V=s make package/n2n/compile V=s ``` diff --git a/packages/openwrt/config.bthh5a b/packages/openwrt/config.bthh5a new file mode 100644 index 0000000..996e25d --- /dev/null +++ b/packages/openwrt/config.bthh5a @@ -0,0 +1,11 @@ +# OpenWrt Configuration snippet +# - will enable building for BT Home Hub 5a +# +CONFIG_TARGET_lantiq=y +CONFIG_TARGET_lantiq_xrx200=y +CONFIG_TARGET_lantiq_xrx200_DEVICE_bt_homehub-v5a=y + +# Would be needed for a full standalone build, but are packages that should +# be available from the distributed openwrt build repository +# CONFIG_PACKAGE_kmod-tun=m +# CONFIG_PACKAGE_libcap=m diff --git a/packages/openwrt/config.n2n b/packages/openwrt/config.n2n new file mode 100644 index 0000000..595f7bc --- /dev/null +++ b/packages/openwrt/config.n2n @@ -0,0 +1,7 @@ +# OpenWrt Configuration snippet +# - will enable building the N2N packages +# +CONFIG_TARGET_lantiq=y +CONFIG_TARGET_lantiq_xrx200=y +CONFIG_TARGET_lantiq_xrx200_DEVICE_bt_homehub-v5a=y + diff --git a/packages/openwrt/config.x86 b/packages/openwrt/config.x86 new file mode 100644 index 0000000..9dc12e3 --- /dev/null +++ b/packages/openwrt/config.x86 @@ -0,0 +1,5 @@ +# OpenWrt Configuration snippet +# - will enable building on x86 target (mainly for build tests) +# +CONFIG_TARGET_x86=y +CONFIG_TARGET_x86_64=y