]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
github: move the clang/gcc build check to GH Actions
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 10 Jun 2020 11:41:28 +0000 (13:41 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 11 Jun 2020 10:15:02 +0000 (12:15 +0200)
Travis CI is getting overloaded, so let's move some load over to GitHub
Actions.

.github/workflows/build_test.yml [new file with mode: 0644]
.travis.yml
travis-ci/managers/ubuntu-build-check.sh [new file with mode: 0755]

diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml
new file mode 100644 (file)
index 0000000..2a6f0df
--- /dev/null
@@ -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
index 6dd313aae605d13116785000723c146c5f346bae..d933ccce0620ef0ca57631d4f88fb527531760ce 100644 (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
diff --git a/travis-ci/managers/ubuntu-build-check.sh b/travis-ci/managers/ubuntu-build-check.sh
new file mode 100755 (executable)
index 0000000..3113b1e
--- /dev/null
@@ -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