mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
206 lines
8.3 KiB
YAML
206 lines
8.3 KiB
YAML
name: Build Artifacts (Linux 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]
|
|
schedule:
|
|
- cron: '0 16 * * *'
|
|
concurrency:
|
|
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
|
|
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
|
|
env:
|
|
CACHE_EPOCH: 127-4
|
|
GOPROXY: direct
|
|
jobs:
|
|
linux-binary-release:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: i386
|
|
qemu_suffix: i386
|
|
- arch: amd64
|
|
qemu_suffix: amd64
|
|
- arch: armhf
|
|
qemu_suffix: armhf
|
|
- arch: armel
|
|
qemu_suffix: armel
|
|
- arch: arm64
|
|
qemu_suffix: aarch64
|
|
- arch: mipsel
|
|
qemu_suffix: mipsel
|
|
- arch: mips64el
|
|
qemu_suffix: mips64el
|
|
- arch: loongarch64
|
|
qemu_suffix: loongarch64
|
|
- arch: riscv64
|
|
qemu_suffix: riscv64
|
|
- arch: riscv32
|
|
qemu_suffix: riscv32
|
|
runs-on: ubuntu-20.04
|
|
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 == 'armhf' }}
|
|
run: |
|
|
cd third_party/libc++abi
|
|
patch -p1 < v8-6.7.17-fix-gcc-unwind-header.patch
|
|
- name: Set SDK_ROOT
|
|
if: ${{ matrix.arch != 'riscv64' && matrix.arch != 'riscv32' }}
|
|
run: |
|
|
echo "SDK_ROOT=${{ github.workspace }}/debian_bullseye_${{ matrix.arch }}-sysroot" >> $GITHUB_ENV
|
|
- name: Set SDK_ROOT for riscv64 and riscv32
|
|
if: ${{ matrix.arch == 'riscv64' || matrix.arch == 'riscv32' }}
|
|
run: |
|
|
echo "SDK_ROOT=${{ github.workspace }}/debian_bullseye_${{ matrix.arch }}-sysroot/sysroot" >> $GITHUB_ENV
|
|
- name: Cache clang
|
|
id: clang-cache
|
|
uses: actions/cache@v4
|
|
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@v4
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-docker-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-docker-
|
|
- name: Cache qemu-user-static
|
|
id: qemu-user-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
qemu-user-static*.deb
|
|
key: ${{ runner.os }}-qemu-8.2.5-ds-1
|
|
- name: Cache sysroot
|
|
id: sysroot-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
${{ github.workspace }}/debian_bullseye_${{ matrix.arch }}-sysroot
|
|
key: ${{ runner.os }}-sysroot-${{ matrix.arch }}-${{ hashFiles('scripts/sysroots.json') }}-v3
|
|
- name: Setup mold linker
|
|
uses: rui314/setup-mold@v1
|
|
with:
|
|
make-default: false
|
|
- name: Setup build flags for mold
|
|
if: ${{ matrix.arch != 'riscv32' && matrix.arch != 'mipsel' && matrix.arch != 'mips64el' }}
|
|
run: |
|
|
echo "EXTRA_BUILD_FLAGS=-use-mold -enable-lto=false" >> $GITHUB_ENV
|
|
- 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: "Install dependency: qemu user cache"
|
|
if: ${{ steps.qemu-user-cache.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
wget http://ftp.us.debian.org/debian/pool/main/q/qemu/qemu-user-static_8.2.5+ds-1_amd64.deb
|
|
- name: "Install dependency: sysroot"
|
|
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' && matrix.arch != 'loongarch64' && matrix.arch != 'riscv64' && matrix.arch != 'riscv32' }}
|
|
run: |
|
|
./scripts/install-sysroot.py --arch ${{ matrix.arch }}
|
|
- name: "Install dependency: sysroot (loongarch64)"
|
|
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' && matrix.arch == 'loongarch64' }}
|
|
run: |
|
|
curl -L https://github.com/Chilledheart/loongson-chromium/releases/download/chromium120/debian_bullseye_loongarch64-sysroot.tar.bz2 | tar --bzip2 -xf -
|
|
- name: "Install dependency: sysroot (riscv64 and riscv32)"
|
|
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' && (matrix.arch == 'riscv64' || matrix.arch == 'riscv32') }}
|
|
run: |
|
|
mkdir -p debian_bullseye_${{ matrix.arch }}-sysroot
|
|
cd debian_bullseye_${{ matrix.arch }}-sysroot
|
|
curl -L https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.07.07/${{ matrix.arch }}-glibc-ubuntu-20.04-gcc-nightly-2023.07.07-nightly.tar.gz | tar --strip-components=1 --gz -xf -
|
|
rm -rf bin include libexec ${{ matrix.arch }}-unknown-linux-gnu share
|
|
cd ..
|
|
- 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: Populate depedencies
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y cmake ninja-build pkg-config gettext bubblewrap
|
|
# libc6-i386 interferes with x86 build
|
|
sudo apt remove libc6-i386
|
|
|
|
sudo apt install qemu-user
|
|
sudo apt remove -y qemu-user-binfmt
|
|
sudo dpkg -i qemu-user-static_*.deb
|
|
- name: Populate dependencie (cmake, overwrite)
|
|
run: |
|
|
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.28.5/cmake-3.28.5-linux-x86_64.tar.gz
|
|
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.28.5-linux-x86_64.tar.gz
|
|
cmake --version
|
|
rm -f *.tar.gz
|
|
- name: Build TGZ packages (CLI and Server)
|
|
run: |
|
|
./tools/build --variant cli --arch ${{ matrix.arch }} --system linux --sysroot ${{ env.SDK_ROOT }} -build-benchmark -build-test -nc ${{ env.EXTRA_BUILD_FLAGS }}
|
|
./tools/build --variant server --arch ${{ matrix.arch }} --system linux --sysroot ${{ env.SDK_ROOT }} -build-benchmark -build-test -nc ${{ env.EXTRA_BUILD_FLAGS }}
|
|
- name: Build TGZ packages (GUI)
|
|
if: ${{ matrix.arch != 'riscv64' && matrix.arch != 'riscv32' }}
|
|
run: |
|
|
./tools/build --variant gui --arch ${{ matrix.arch }} --system linux --sysroot ${{ env.SDK_ROOT }} -build-benchmark -build-test -nc ${{ env.EXTRA_BUILD_FLAGS }}
|
|
- name: Run tests (i386 and amd64)
|
|
if: ${{ matrix.arch == 'i386' || matrix.arch == 'amd64' }}
|
|
run: |
|
|
mkdir -p $SDK_ROOT/etc $SDK_ROOT/dev $SDK_ROOT/proc $SDK_ROOT/tmp
|
|
touch $SDK_ROOT/etc/resolv.conf
|
|
bwrap --die-with-parent --bind $SDK_ROOT / \
|
|
--ro-bind /sys /sys \
|
|
--ro-bind /etc/resolv.conf /etc/resolv.conf \
|
|
--proc /proc --dev /dev \
|
|
--unshare-all --share-net \
|
|
--bind $PWD/build-linux-${{ matrix.arch }} /tmp \
|
|
/tmp/yass_test
|
|
- name: Run tests (non x86, under qemu emulation)
|
|
if: ${{ matrix.arch != 'i386' && matrix.arch != 'amd64' }}
|
|
run: |
|
|
qemu-${{ matrix.qemu_suffix }}-static -L $SDK_ROOT \
|
|
$PWD/build-linux-${{ matrix.arch }}/yass_test \
|
|
--no_exec_proc_tests
|
|
- 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
|