mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
312 lines
11 KiB
YAML
312 lines
11 KiB
YAML
name: Build Artifacts (RPM)
|
|
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: 130-2
|
|
GOPROXY: direct
|
|
jobs:
|
|
docker_publish:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
container:
|
|
- 'centos8'
|
|
- 'centos9'
|
|
- 'fedora39'
|
|
- 'alpine320'
|
|
- 'i386-alpine320'
|
|
- 'armhf-alpine320'
|
|
- 'aarch64-alpine320'
|
|
- 'opensuse15'
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- uses: actions/checkout@v4
|
|
- name: Cache docker files (dummy)
|
|
id: docker-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
docker/dummy
|
|
key: ${{ runner.os }}-docker-${{ matrix.container }}-${{ hashFiles(format('docker/{0}.Dockerfile', matrix.container)) }}-v1
|
|
- name: Login to GitHub Container Registry
|
|
if: ${{ steps.docker-cache.outputs.cache-hit != 'true' }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build Docker Image
|
|
if: ${{ steps.docker-cache.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
cd docker
|
|
docker build --cache-from ghcr.io/chilledheart/${{ matrix.container }} \
|
|
-f ${{ matrix.container }}.Dockerfile \
|
|
-t ghcr.io/chilledheart/${{ matrix.container }} \
|
|
.
|
|
- name: Push Docker Image
|
|
if: ${{ steps.docker-cache.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
docker push --all-tags ghcr.io/chilledheart/${{ matrix.container }}
|
|
rpm-release:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- container: 'centos8'
|
|
gui_variant: gtk3
|
|
- container: 'centos8'
|
|
gui_variant: qt5
|
|
# qt6 sits on epel repo, disabling
|
|
# - container: 'centos9'
|
|
# gui_variant: qt6
|
|
# use_cet: true
|
|
# - container: 'fedora39'
|
|
# gui_variant: gtk3
|
|
# use_cet: true
|
|
# - container: 'fedora39'
|
|
# gui_variant: gtk4
|
|
# use_cet: true
|
|
# https://rpmfind.net/linux/rpm2html/search.php?query=glibc-devel&submit=Search+...&system=&arch=
|
|
# glibc: 2.38 for fedora39
|
|
# glibc: 2.39 for fedora40
|
|
# - container: 'fedora39'
|
|
# gui_variant: qt6
|
|
# use_cet: true
|
|
# for opensuse users, you can use centos7's rpm packages
|
|
# - container: 'opensuse15'
|
|
# gui_variant: gtk3
|
|
# - container: 'opensuse15'
|
|
# gui_variant: qt5
|
|
# except for gtk4 and qt6 packages
|
|
# glibc: 2.31 for opensuse15.5
|
|
- container: 'opensuse15'
|
|
gui_variant: gtk4
|
|
- container: 'opensuse15'
|
|
gui_variant: qt6
|
|
runs-on: ubuntu-22.04
|
|
needs: docker_publish
|
|
container:
|
|
image: 'ghcr.io/chilledheart/${{ matrix.container }}'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Checkout with shallow submodules
|
|
run: |
|
|
# ignore annoying failures
|
|
git config --global --add safe.directory "$PWD"
|
|
# unshallow must come first otherwise submodule may be get unshallowed
|
|
git fetch --tags --unshallow
|
|
git submodule update --init --depth 1
|
|
- 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 }}
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '>=1.20.0'
|
|
cache-dependency-path: |
|
|
tools/go.sum
|
|
third_party/boringssl/src/go.sum
|
|
- 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: Set clang environment
|
|
run: |
|
|
# use custom compiler
|
|
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
|
|
echo "USE_CLANG=1" >> $GITHUB_ENV
|
|
- name: Set cet option
|
|
if: ${{ matrix.use_cet == true }}
|
|
run: |
|
|
# use CET
|
|
echo "USE_CET=1" >> $GITHUB_ENV
|
|
- name: Set c++ standard library environment
|
|
run: |
|
|
# use custom libc++
|
|
echo "USE_LIBCXX=1" >> $GITHUB_ENV
|
|
- name: Set QT6 environment
|
|
if: ${{ matrix.gui_variant == 'qt6' }}
|
|
run: |
|
|
echo "USE_QT6=1" >> $GITHUB_ENV
|
|
- name: Set QT5 environment
|
|
if: ${{ matrix.gui_variant == 'qt5' }}
|
|
run: |
|
|
echo "USE_QT5=1" >> $GITHUB_ENV
|
|
- name: Set GTK4 environment
|
|
if: ${{ matrix.gui_variant == 'gtk4' }}
|
|
run: |
|
|
echo "USE_GTK4=1" >> $GITHUB_ENV
|
|
- name: Build RPM packages
|
|
run: |
|
|
./scripts/build-rpm.sh
|
|
- name: Upload dist tarball (including debuginfo)
|
|
if: ${{ github.event_name == 'release' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release upload --clobber ${{ github.event.release.tag_name }} yass*.rpm
|
|
musl-release:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- container: 'alpine320'
|
|
arch: amd64
|
|
- container: 'i386-alpine320'
|
|
arch: i386
|
|
- container: 'aarch64-alpine320'
|
|
arch: aarch64
|
|
- container: 'armhf-alpine320'
|
|
arch: armhf
|
|
runs-on: ubuntu-20.04
|
|
needs: docker_publish
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Checkout with shallow submodules
|
|
run: |
|
|
# ignore annoying failures
|
|
git config --global --add safe.directory "$PWD"
|
|
# unshallow must come first otherwise submodule may be get unshallowed
|
|
git fetch --tags --unshallow
|
|
git submodule update --init --depth 1
|
|
- name: Set SDK_ROOT
|
|
run: |
|
|
echo "SDK_ROOT=${{ github.workspace }}/${{ matrix.arch }}-alpine320-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 }}
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '>=1.20.0'
|
|
cache-dependency-path: |
|
|
tools/go.sum
|
|
third_party/boringssl/src/go.sum
|
|
- name: Cache qemu-user
|
|
id: qemu-user-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
qemu-user*.deb
|
|
key: ${{ runner.os }}-qemu-9.1.0-ds-8
|
|
- 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_9.1.0+ds-8_amd64.deb
|
|
- name: Populate depedencies
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y cmake ninja-build pkgconf gettext bubblewrap
|
|
# libc6-i386 interferes with x86 build
|
|
sudo apt remove libc6-i386
|
|
|
|
sudo dpkg -i qemu-user_*.deb
|
|
- name: Populate sysroot from docker image
|
|
run: |
|
|
docker pull ghcr.io/chilledheart/${{ matrix.container }}
|
|
mkdir -p "${{ env.SDK_ROOT }}"
|
|
docker export $(docker create --platform ${{ matrix.arch }} ghcr.io/chilledheart/${{ matrix.container }}) | tar -C "${{ env.SDK_ROOT }}" -xf -
|
|
- 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: Populate depedencies
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y cmake ninja-build pkgconf gettext bubblewrap
|
|
# libc6-i386 interferes with x86 build
|
|
sudo apt remove libc6-i386
|
|
- name: Populate dependencie (cmake, overwrite)
|
|
run: |
|
|
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.28.6/cmake-3.28.6-linux-x86_64.tar.gz
|
|
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.28.6-linux-x86_64.tar.gz
|
|
cmake --version
|
|
rm -f *.tar.gz
|
|
- name: Build TGZ packages
|
|
run: |
|
|
./tools/build --variant cli --arch ${{ matrix.arch }} --system linux --subsystem musl --sysroot "${{ env.SDK_ROOT }}" -build-test --cmake-build-type MinSizeRel -use-static-build -nc
|
|
./tools/build --variant server --arch ${{ matrix.arch }} --system linux --subsystem musl --sysroot "${{ env.SDK_ROOT }}" -build-test --cmake-build-type MinSizeRel -use-static-build -nc
|
|
./tools/build --variant gui --arch ${{ matrix.arch }} --system linux --subsystem musl --sysroot "${{ env.SDK_ROOT }}" -build-test --cmake-build-type MinSizeRel -nc
|
|
- name: Run tests (i386 and amd64)
|
|
if: ${{ matrix.arch == 'i386' || matrix.arch == 'amd64' }}
|
|
run: |
|
|
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-musl-${{ matrix.arch }} /tmp \
|
|
/tmp/yass_test
|
|
- name: Run tests (non x86, under qemu emulation)
|
|
if: ${{ matrix.arch != 'i386' && matrix.arch != 'amd64' }}
|
|
run: |
|
|
# copy required resolv.conf from host
|
|
cp -fv /etc/resolv.conf "$SDK_ROOT/etc/resolv.conf"
|
|
# TMPDIR is required by leveldb unittests
|
|
qemu-${{ matrix.arch }} -L $SDK_ROOT \
|
|
-E TMPDIR=$PWD/build-linux-musl-${{ matrix.arch }} \
|
|
$PWD/build-linux-musl-${{ 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
|
|
- name: Cleanup before Cache callbacks
|
|
run: |
|
|
rm -rf build-*
|
|
|