Skip to content

gh action: compiler bot run non-xp mingw build #682

gh action: compiler bot run non-xp mingw build

gh action: compiler bot run non-xp mingw build #682

name: Build Artifacts (OpenWrt Binary)
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
pull_request:
branches: [master, develop]
paths-ignore:
- '**/*.md'
- '.circleci/**'
- '.cirrus.yml'
push:
branches: [master, develop]
paths-ignore:
- '**/*.md'
- '.circleci/**'
- '.cirrus.yml'
release:
types: [published]
env:
CACHE_EPOCH: 121-2
GOPROXY: direct
jobs:
openwrt-binary-release:
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
subarch: x86_64
openwrt: 'target=x86 subtarget=64 abi=musl'
- arch: x86
subarch: i486
openwrt: 'target=x86 subtarget=generic abi=musl'
runs-on: ubuntu-20.04
env:
OPENWRT_FLAGS: arch=${{ matrix.arch }} release=22.03.5 gcc_ver=11.2.0 ${{ matrix.openwrt }}
SDK_ROOT: ${{ github.workspace }}/openwrt-sdk-${{ matrix.arch }}
SDK_HOME: ${{ github.workspace }}/openwrt-sdk-${{ matrix.arch }}-home
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Patch libcxxabi for both of armel and armhf
if: ${{ matrix.arch == 'armel' || matrix.arch == 'arm' }}
run: |
cd third_party/libc++abi
patch -p1 < v8-6.7.17-fix-gcc-unwind-header.patch
- name: Cache clang
id: clang-cache
uses: actions/cache@v3
with:
path: |
third_party/llvm-build/Release+Asserts
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- name: Cache golang
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-docker-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-docker-
- name: Cache openwrt sdk home
id: openwrt-sdkhome-cache
uses: actions/cache@v3
with:
path: |
openwrt-sdk-*.Linux-x86_64
${{ env.SDK_ROOT }}
${{ env.SDK_HOME }}
key: openwrt-sdkhome-v0-${{ matrix.arch }}-v${{ env.CACHE_EPOCH }}
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: prebuilt clang and clang-tidy binaries"
if: ${{ steps.clang-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-clang-prebuilt-binaries.py
rm -f third_party/llvm-build/Release+Asserts/*.tgz
- name: Change ubuntu mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update -qq
- name: "Install dependency: openwrt sdkhome"
if: ${{ steps.openwrt-sdkhome-cache.outputs.cache-hit != 'true' }}
run: |
eval "$OPENWRT_FLAGS"
if [ "$subtarget" ]; then
SDK_PATH=openwrt-sdk-$release-$target-${subtarget}_gcc-${gcc_ver}_${abi}.Linux-x86_64
else
subtarget='generic'
SDK_PATH=openwrt-sdk-$release-${target}_gcc-${gcc_ver}_${abi}.Linux-x86_64
fi
SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz
curl -L -O $SDK_URL
# full_root=$SDK_PATH/staging_dir/toolchain-*_gcc-${gcc_ver}_${abi}
full_root=$(tar -tf $SDK_PATH.tar.xz "$SDK_PATH/staging_dir/" |grep -E "/toolchain-.*_gcc-${gcc_ver}_${abi}/$")
#tar -C $SDK_ROOT -xf $SDK_PATH.tar.xz --strip-components 3 $full_root
tar -xf $SDK_PATH.tar.xz
# fix dl directory
rm -rf $SDK_PATH/dl
ln -sf /tmp $SDK_PATH/dl
# fix package directory
ln -sf $PWD/openwrt $SDK_PATH/package/yass-cli
ln -sf $SDK_PATH ${{ env.SDK_HOME }}
ln -sf $full_root ${{ env.SDK_ROOT }}
rm -rf ${{ env.SDK_ROOT }}/bin ${{ env.SDK_ROOT }}/libexec
- name: Populate depedencies
run: |
sudo apt-get update -qq
sudo apt-get install -y cmake ninja-build pkg-config bubblewrap
# libc6-i386 interferes with x86 build
sudo apt remove libc6-i386
# required by mbedtls build
sudo apt-get install -y python3-jsonschema python3-jinja2
- name: Set clang environment
run: |
echo "CC=${{ github.workspace }}/third_party/llvm-build/Release+Asserts/bin/clang" >> $GITHUB_ENV
echo "CXX=${{ github.workspace }}/third_party/llvm-build/Release+Asserts/bin/clang++" >> $GITHUB_ENV
- name: Build TGZ packages
run: |
./tools/build --variant cli --arch ${{ matrix.subarch }} --system linux --subsystem openwrt --sysroot ${{ env.SDK_ROOT }} \
--cmake-build-type MinSizeRel -build-benchmark -build-test -nc
./tools/build --variant server --arch ${{ matrix.subarch }} --system linux --subsystem openwrt --sysroot ${{ env.SDK_ROOT }} \
--cmake-build-type MinSizeRel -build-benchmark -build-test -nc
- name: Run tests (x86 and x86_64)
if: ${{ matrix.arch == 'x86' || matrix.arch == 'x86_64' }}
run: |
mkdir -p ${{ env.SDK_ROOT }}/etc ${{ env.SDK_ROOT }}/dev ${{ env.SDK_ROOT }}/proc ${{ env.SDK_ROOT }}/tmp
touch ${{ env.SDK_ROOT }}/etc/resolv.conf
bwrap --die-with-parent --ro-bind ${{ env.SDK_ROOT }} / \
--ro-bind /etc/resolv.conf /etc/resolv.conf \
--proc /proc --dev /dev \
--unshare-all --share-net \
--bind $PWD/build-linux-openwrt-${{ matrix.subarch }} /tmp \
/tmp/yass_test
- name: Upload dist tarball (including debuginfo)
if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} yass*.tgz
- name: Build IPK packages
run: |
pushd ${{ env.SDK_HOME }}
make defconfig
make package/yass-cli/{clean,compile} V=s
popd
find ${{ env.SDK_HOME }}/ -type f -name "yass*.ipk" -exec cp -v {} . \;
# clean up after build
pushd ${{ env.SDK_HOME }}
make package/yass-cli/clean V=s
popd
- name: Upload dist tarball (including debuginfo)
if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} yass*.ipk