github: move the clang/gcc build check to GH Actions

Travis CI is getting overloaded, so let's move some load over to GitHub
Actions.
This commit is contained in:
Frantisek Sumsal 2020-06-10 13:41:28 +02:00
parent 48c6399ad8
commit aab86b12dd
3 changed files with 128 additions and 42 deletions

44
.github/workflows/build_test.yml vendored Normal file
View File

@ -0,0 +1,44 @@
---
# vi: ts=2 sw=2 et:
#
name: Build test
on:
pull_request:
paths:
- '**/meson.build'
- '.github/workflows/**'
- 'meson_options.txt'
- 'src/**'
- 'test/fuzz/**'
- 'travis-ci/managers/ubuntu-build-check.sh'
jobs:
build:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
env:
# As we use postfixed clang/gcc binaries, we need to override $AR
# as well, otherwise meson falls back to ar from binutils which
# doesn't work with LTO
- { CC: "clang-10", CXX: "clang++-10", AR: "llvm-ar-10" }
- { CC: "gcc-10", CXX: "g++-10", AR: "gcc-ar-10" }
env: ${{ matrix.env }}
steps:
- name: Repository checkout
uses: actions/checkout@v1
- name: Configure custom APT repositories for ${{ env.CC }}
run: |
if [[ "$CC" == clang-* ]]; then
# Latest LLVM stack deb packages provided by https://apt.llvm.org/
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt-get install clang-10 llvm-10
else
# Latest gcc stack deb packages provided by
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install gcc-10
fi
- name: Build check (${{ env.CC }})
run: sudo -E travis-ci/managers/ubuntu-build-check.sh

View File

@ -11,9 +11,6 @@ env:
- REPO_ROOT="$TRAVIS_BUILD_DIR"
stages:
- name: Build check
if: type != cron
- name: Build & test
if: type != cron
@ -23,45 +20,6 @@ stages:
jobs:
include:
- stage: Build check
name: Fedora Rawhide (gcc)
language: bash
env:
- FEDORA_RELEASE="rawhide"
- CONT_NAME="systemd-fedora-$FEDORA_RELEASE"
- DOCKER_EXEC="docker exec -ti $CONT_NAME"
before_install:
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- docker --version
install:
- $CI_MANAGERS/fedora.sh SETUP
script:
- set -e
# Build systemd
- $CI_MANAGERS/fedora.sh RUN_BUILD_CHECK_GCC
- set +e
after_script:
- $CI_MANAGERS/fedora.sh CLEANUP
- name: Fedora Rawhide (clang)
language: bash
env:
- FEDORA_RELEASE="rawhide"
- CONT_NAME="systemd-fedora-$FEDORA_RELEASE"
- DOCKER_EXEC="docker exec -ti $CONT_NAME"
before_install:
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- docker --version
install:
- $CI_MANAGERS/fedora.sh SETUP
script:
- set -e
# Build systemd
- $CI_MANAGERS/fedora.sh RUN_BUILD_CHECK_CLANG
- set +e
after_script:
- $CI_MANAGERS/fedora.sh CLEANUP
- stage: Build & test
name: Debian Testing
language: bash

View File

@ -0,0 +1,84 @@
#!/bin/bash
set -e
info() { echo -e "\033[33;1m$1\033[0m"; }
error() { echo >&2 -e "\033[31;1m$1\033[0m"; }
success() { echo >&2 -e "\033[32;1m$1\033[0m"; }
ARGS=(
"--optimization=0"
"--optimization=2"
"--optimization=3"
"--optimization=s"
"-Db_lto=true"
"-Db_ndebug=true"
)
PACKAGES=(
cryptsetup-bin
gettext
iptables-dev
iputils-ping
isc-dhcp-client
itstool
kbd
libblkid-dev
libcap-dev
libcurl4-gnutls-dev
libgpg-error-dev
liblz4-dev
liblzma-dev
libmicrohttpd-dev
libmount-dev
libqrencode-dev
libxkbcommon-dev
mount
net-tools
ninja-build
perl
python-lxml
python3-evdev
python3-lxml
python3-pip
python3-pyparsing
python3-setuptools
quota
strace
unifont
expect
util-linux
)
CC="${CC:?}"
CXX="${CXX:?}"
AR="${AR:-""}"
RELEASE="$(lsb_release -cs)"
bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ $RELEASE main restricted universe multiverse' >>/etc/apt/sources.list"
apt-get update
apt-get build-dep systemd -y
apt-get install -y "${PACKAGES[@]}"
# Install latest meson from pip, as the distro-one doesn't support
# --optimization=
pip3 install meson
$CC --version
for args in "${ARGS[@]}"; do
SECONDS=0
info "Checking build with $args"
if ! AR="$AR" CC="$CC" CXX="$CXX" meson --werror $args build; then
error "meson failed with $args"
exit 1
fi
if ! ninja -C build; then
error "ninja failed with $args"
exit 1
fi
git clean -dxf
success "Build with $args passed in $SECONDS seconds"
done