diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2020-06-11 18:04:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 18:04:13 +0300 |
commit | 60950f3c252ee4dc39ac60b3c59e0cfdd8e95920 (patch) | |
tree | 8e2a7a89e59feb92f09e6b7ba4cf8bc7dd10c6b6 | |
parent | ed6727d40ae31df16c989763160ac511c67bac5f (diff) | |
parent | 86a23f38abd902e767c1a89696ce98ee19df864c (diff) | |
download | systemd-60950f3c252ee4dc39ac60b3c59e0cfdd8e95920.tar.gz |
Merge pull request #16144 from mrc0mmand/gh-actions-followup
GH Actions followup
-rw-r--r-- | .github/workflows/build_test.yml | 24 | ||||
-rwxr-xr-x | .github/workflows/ubuntu-build-check.sh | 117 | ||||
-rwxr-xr-x | travis-ci/managers/ubuntu-build-check.sh | 93 |
3 files changed, 121 insertions, 113 deletions
diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 2a6f0df9c4..3b86689d27 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -10,7 +10,6 @@ on: - 'meson_options.txt' - 'src/**' - 'test/fuzz/**' - - 'travis-ci/managers/ubuntu-build-check.sh' jobs: build: @@ -19,26 +18,11 @@ jobs: 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" } + - { COMPILER: "gcc", COMPILER_VERSION: "10" } + - { COMPILER: "clang", COMPILER_VERSION: "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 + - name: Build check (${{ env.COMPILER }}-${{ env.COMPILER_VERSION }}) + run: sudo -E .github/workflows/ubuntu-build-check.sh diff --git a/.github/workflows/ubuntu-build-check.sh b/.github/workflows/ubuntu-build-check.sh new file mode 100755 index 0000000000..fb7c71ecb8 --- /dev/null +++ b/.github/workflows/ubuntu-build-check.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +set -ex + +info() { echo -e "\033[33;1m$1\033[0m"; } +fatal() { echo >&2 -e "\033[31;1m$1\033[0m"; exit 1; } +success() { echo >&2 -e "\033[32;1m$1\033[0m"; } + +ARGS=( + "--optimization=0" + "--optimization=2" + "--optimization=s" + "--optimization=3 -Db_lto=true" + "--optimization=3 -Db_lto=false" + "-Db_ndebug=true" +) +PACKAGES=( + cryptsetup-bin + expect + fdisk + gettext + iptables-dev + iputils-ping + isc-dhcp-client + itstool + kbd + libblkid-dev + libcap-dev + libcurl4-gnutls-dev + libfdisk-dev + libgpg-error-dev + liblz4-dev + liblzma-dev + libmicrohttpd-dev + libmount-dev + libp11-kit-dev + libpwquality-dev + libqrencode-dev + libssl-dev + libxkbcommon-dev + libzstd-dev + mount + net-tools + perl + python-lxml + python3-evdev + python3-lxml + python3-pip + python3-pyparsing + python3-setuptools + quota + strace + unifont + util-linux + zstd +) +COMPILER="${COMPILER:?}" +COMPILER_VERSION="${COMPILER_VERSION:?}" +RELEASE="$(lsb_release -cs)" + +bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ $RELEASE main restricted universe multiverse' >>/etc/apt/sources.list" + +# Note: 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 +if [[ "$COMPILER" == clang ]]; then + CC="clang-$COMPILER_VERSION" + CXX="clang++-$COMPILER_VERSION" + AR="llvm-ar-$COMPILER_VERSION" + # Latest LLVM stack deb packages provided by https://apt.llvm.org/ + # Following snippet was borrowed from https://apt.llvm.org/llvm.sh + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + add-apt-repository -y "deb http://apt.llvm.org/$RELEASE/ llvm-toolchain-$RELEASE-$COMPILER_VERSION main" + PACKAGES+=(clang-$COMPILER_VERSION lldb-$COMPILER_VERSION lld-$COMPILER_VERSION clangd-$COMPILER_VERSION) +elif [[ "$COMPILER" == gcc ]]; then + CC="gcc-$COMPILER_VERSION" + CXX="g++-$COMPILER_VERSION" + AR="gcc-ar-$COMPILER_VERSION" + # 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 + PACKAGES+=(gcc-$COMPILER_VERSION) +else + fatal "Unknown compiler: $COMPILER" +fi + +# PPA with some newer build dependencies (like zstd) +add-apt-repository -y ppa:upstream-systemd-ci/systemd-ci +apt-get -y update +apt-get -y build-dep systemd +apt-get -y install "${PACKAGES[@]}" +# Install the latest meson and ninja form pip, since the distro versions don't +# support all the features we need (like --optimization=). Since the build-dep +# command above installs the distro versions, let's install the pip ones just +# locally and add the local bin directory to the $PATH. +pip3 install --user -U meson ninja +export PATH="$HOME/.local/bin:$PATH" + +$CC --version + +for args in "${ARGS[@]}"; do + SECONDS=0 + + info "Checking build with $args" + if ! AR="$AR" CC="$CC" CXX="$CXX" meson -Dtests=unsafe -Dslow-tests=true --werror $args build; then + fatal "meson failed with $args" + fi + + ninja --version + if ! ninja -C build; then + fatal "ninja failed with $args" + fi + + git clean -dxf + + success "Build with $args passed in $SECONDS seconds" +done diff --git a/travis-ci/managers/ubuntu-build-check.sh b/travis-ci/managers/ubuntu-build-check.sh deleted file mode 100755 index c2a7feee60..0000000000 --- a/travis-ci/managers/ubuntu-build-check.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/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 - expect - fdisk - gettext - iptables-dev - iputils-ping - isc-dhcp-client - itstool - kbd - libblkid-dev - libcap-dev - libcurl4-gnutls-dev - libfdisk-dev - libgpg-error-dev - liblz4-dev - liblzma-dev - libmicrohttpd-dev - libmount-dev - libp11-kit-dev - libpwquality-dev - libqrencode-dev - libssl-dev - libxkbcommon-dev - libzstd-dev - mount - net-tools - ninja-build - perl - python-lxml - python3-evdev - python3-lxml - python3-pip - python3-pyparsing - python3-setuptools - quota - strace - unifont - util-linux - zstd -) -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" - -# PPA with some newer build dependencies (like zstd) -add-apt-repository -y ppa:upstream-systemd-ci/systemd-ci -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 |