You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
2.7 KiB

Update Openwrt process (#900) * First attempt at a openwrt CI * Fix action - helps if I dont forget the syntax half way through writing it * Try building /this/ branch for the openwrt CI * Try a build with openssl configured * Dont enable the n2n package until we have built the environment - makes errors easier to see and clearly related to n2n * Attempt to speed up the openwrt build * Upload any created ipkg packages * Dont test with openssl for the moment * Attempt to speed up openwrt build using a cache of the build dir * The make defconfig run turns all the built binaries stale, so stop caching them. Also use a real ref for the cache key * Minor text name changes * Address yamllint concerns * Attempt to simplify and document missing parts of the openwrt makefile * Attempt to fix mystery openwrt make error * Rename build job name * Avoid nested checkouts, use two separate dirs for the two checkouts in this build * Move the n2n checkout to earler, allowing us to skip one defconfig run * We are going to need working tags from the n2n repo, so ensure we unbreak the github checkout braindamage * Calculate and save the n2n version string * Prepare the way to pass the correct external vars into the openwrt build * Hook calculated build variables into the openwrt package definition * Update artifacts source to match moved checkout dir * Pass env vars in to the make * Allow version script to be influenced by external vars * It will help if I use the same variable names everywhere * Add more version variable calculation overrides * Configure openwrt to use the external git checkout instead of their create-tar-then-extract dance * Using the correct syntax for ifdef will help significantly * Use as many jobs as we have cpus * As the USE_SOURCE_DIR option allows us to use a full git checkout, we do not need to hack the version.sh to allow overrides * Ensure scripts/version.sh works from anywhere * Remove unneeded variables * Update openwrt build documentation to match the new build process * Catch failure to cd as per shellcheck suggestion * Limit lengthy openwrt builds to manual triggers or on a release * Also run on specially named branches * Break list into separate lines for easier future editing
3 years ago
---
name: Openwrt Build
# yamllint disable-line rule:truthy
on:
release:
types:
- published
- created
- edited
push:
branches:
- openwrt
workflow_dispatch:
jobs:
build:
name: Build ipkg
runs-on: ubuntu-latest
defaults:
run:
working-directory: openwrt
steps:
- name: Checkout openwrt
uses: actions/checkout@v2
with:
path: openwrt
repository: openwrt/openwrt
- name: Set openwrt ref
id: openwrt_ref
run: |
echo ::set-output name=REF::$(git rev-parse --short HEAD)
git rev-parse --short HEAD
- name: Checkout n2n
uses: actions/checkout@v2
with:
path: n2n
fetch-depth: 0
- name: Fix Checkout
run: |
git fetch --force --tags
working-directory: n2n
- name: Set n2n ref
id: n2n_ref
run: |
echo ::set-output name=REF::$(./scripts/version.sh)
./scripts/version.sh
working-directory: n2n
- name: Copy n2n package definition into openwrt
run: |
cp -r n2n/packages/openwrt openwrt/package/n2n
working-directory: ./
- name: Cache openwrt source downloads
uses: actions/cache@v2
with:
path: openwrt/dl
key: openwrt-dl-${{ steps.openwrt_ref.outputs.REF }}
- name: Setup openwrt config and environment
run: |
echo "CONFIG_TARGET_x86=y" >.config
echo "CONFIG_TARGET_x86_64=y" >>.config
- name: Add n2n package to openwrt config
run: |
echo "CONFIG_PACKAGE_n2n-edge=m" >>.config
echo "CONFIG_PACKAGE_n2n-supernode=m" >>.config
- name: Build a full config from our stub file
run: |
make defconfig
- name: Download openwrt sources
run: |
make download
- name: Build openwrt build environment
run: |
make -j `nproc` tools/install toolchain/install
- name: Build n2n dependancies
run: |
make -j `nproc` package/libs/libpcap/compile
- name: Build n2n openwrt packages
env:
N2N_PKG_VERSION: ${{ steps.n2n_ref.outputs.REF }}
run: |
echo "Build for $N2N_PKG_VERSION"
export 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: Upload built artifacts
uses: actions/upload-artifact@v2
with:
name: built-ipkgs
path: openwrt/bin/packages/*/base/*.ipk