CI under Github
v2 cover CI under Github
Hi,
Add a Continuous Integration builds under Github (with its Actions) to build and unit test on several configurations.
Changes since v1 [1]:
1. Rebase on latest master.
2. Remove CI-unrelated patches from this set.
3. Add CodeQL analysis.
4. Add builds and tests with GCC sanitizers.
5. Use matrix to extend the build configuration.
[1] https://lore.kernel.org/linux-nfc/20210710033859.3989-1-krzysztof.kozlowski(a)canonical.com/
Best regards,
Krzysztof
Krzysztof Kozlowski (11):
ci: add GitHub actions for building
bootstrap: parse CROSS_COMPILE and set proper configure option
ci: add clang builds
ci: add building without maintainer options
ci: be verbose when building
ci: add more build configurations (Fedora, Alpine, Debian,
cross-compile, i386)
ci: run unit tests
ci: add build with sanitizers (asan, lsan and ubsan)
ci: add CodeQL static analysis
ci: print configure logs on failures
ci: use matrix instead of duplicating each build configuration
.github/workflows/ci.yml | 255 ++++++++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 45 +++++ bootstrap-configure | 6 + ci/alpine.sh | 42 +++++ ci/debian.cross-compile.sh | 41 +++++ ci/debian.i386.sh | 32 ++++ ci/debian.sanitizers.sh | 18 ++ ci/debian.sh | 41 +++++ ci/fedora.sh | 33 ++++ ci/ubuntu.cross-compile.sh | 1 + ci/ubuntu.i386.sh | 1 + ci/ubuntu.sanitizers.sh | 1 + ci/ubuntu.sh | 1 + 13 files changed, 517 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100755 ci/alpine.sh create mode 100755 ci/debian.cross-compile.sh create mode 100755 ci/debian.i386.sh create mode 100755 ci/debian.sanitizers.sh create mode 100755 ci/debian.sh create mode 100755 ci/fedora.sh create mode 120000 ci/ubuntu.cross-compile.sh create mode 120000 ci/ubuntu.i386.sh create mode 120000 ci/ubuntu.sanitizers.sh create mode 120000 ci/ubuntu.sh
Signature · 1 line
2.30.2
PATCH v2 1/11 ci: add GitHub actions for building
--- .github/workflows/ci.yml | 79 ++++++++++++++++++++++++++++++++++++++++ ci/debian.sh | 32 ++++++++++++++++ ci/ubuntu.sh | 1 + 3 files changed, 112 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100755 ci/debian.sh create mode 120000 ci/ubuntu.sh
.github/workflows/ci.yml new file +79 -0
@@ -0,0 +1,79 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# Loosely based on https://github.com/linux-test-project/ltp +# +name: "Builds" +on: [push, pull_request] + +jobs: + job: + name: Build + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - container: "ubuntu:hirsute" + env: + CC: gcc + + - container: "ubuntu:focal" + env: + CC: gcc + + - container: "ubuntu:bionic" + env: + CC: gcc + + - container: "ubuntu:xenial" + env: + CC: gcc + + container: + image: ${{ matrix.container }} + env: ${{ matrix.env }} + + steps: + - name: Show OS + run: cat /etc/os-release + + - name: Git checkout + uses: actions/checkout(a)v2 + + - name: Install additional packages + run: | + INSTALL=${{ matrix.container }} + INSTALL="${INSTALL%%:*}" + INSTALL="${INSTALL%%/*}" + ./ci/$INSTALL.sh + if [ "$VARIANT" ]; then ./ci/$INSTALL.$VARIANT.sh; fi + + - name: Compiler version + run: $CC --version + + - name: Display environment and Linux version + run: | + test -f /etc/issue && cat /etc/issue + lsb_release -a || true + uname -a + cat /proc/cmdline + printenv + + - name: Configure + run: ./bootstrap-configure + + - name: Compile + run: make -j$(nproc) + + - name: Install + run: make install + + - name: Distribution check + run: make distcheck
ci/debian.sh new file +32 -0
@@ -0,0 +1,32 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# + +set -eEx + +apt update + +# Some distros (e.g. Ubuntu Hirsute) might pull tzdata which asks questions +export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true + +# Choose some random place in Europe +echo "tzdata tzdata/Areas select Europe +tzdata tzdata/Zones/Europe select Berlin +" > /tmp/tzdata-preseed.txt +debconf-set-selections /tmp/tzdata-preseed.txt + +apt install -y --no-install-recommends \ + autoconf \ + autoconf-archive \ + automake \ + build-essential \ + libdbus-1-dev \ + libglib2.0-dev \ + libnl-3-dev \ + libnl-genl-3-dev \ + libtool \ +
ci/ubuntu.sh new file +1 -0
@@ -0,0 +1 @@ +debian.sh
Signature · 1 line
2.30.2
PATCH v2 2/11 bootstrap: parse CROSS_COMPILE and set proper configure option
In reply to Krzysztof KozlowskiMakes cross compiling in CI easier.
--- bootstrap-configure | 6 ++++++ 1 file changed, 6 insertions(+)
bootstrap-configure +6 -0
@@ -4,6 +4,11 @@ if [ -f config.status ]; then make maintainer-clean fi +CONFIGURE_CROSS="" +if [ "$CROSS_COMPILE" ]; then + CONFIGURE_CROSS="--host=${CROSS_COMPILE}" +fi + ./bootstrap && \ ./configure --enable-maintainer-mode \ --enable-debug \
@@ -11,4 +16,5 @@ fi --prefix=/usr \ --enable-ese \ --sysconfdir=/etc \ + "$CONFIGURE_CROSS" \ --enable-tools "$@"
Signature · 1 line
2.30.2
PATCH v2 3/11 ci: add clang builds
In reply to Krzysztof Kozlowski--- .github/workflows/ci.yml | 10 ++++++++++ ci/debian.sh | 10 ++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
.github/workflows/ci.yml +10 -0
@@ -20,6 +20,7 @@ jobs: fail-fast: false matrix: include: + # Ubuntu gcc - container: "ubuntu:hirsute" env: CC: gcc
@@ -36,6 +37,15 @@ jobs: env: CC: gcc + # Ubuntu clang + - container: "ubuntu:hirsute" + env: + CC: clang + + - container: "ubuntu:focal" + env: + CC: clang + container: image: ${{ matrix.container }} env: ${{ matrix.env }}
ci/debian.sh +8 -2
@@ -19,14 +19,20 @@ tzdata tzdata/Zones/Europe select Berlin " > /tmp/tzdata-preseed.txt debconf-set-selections /tmp/tzdata-preseed.txt +PKGS_CC="build-essential" +if [ "$CC" = "clang" ]; then + PKGS_CC="clang" +fi + + apt install -y --no-install-recommends \ autoconf \ autoconf-archive \ automake \ - build-essential \ libdbus-1-dev \ libglib2.0-dev \ libnl-3-dev \ libnl-genl-3-dev \ libtool \ - + make \ + $PKGS_CC
Signature · 1 line
2.30.2
PATCH v2 4/11 ci: add building without maintainer options
In reply to Krzysztof KozlowskiCheck also silent builds.
--- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
.github/workflows/ci.yml +35 -1
@@ -24,27 +24,49 @@ jobs: - container: "ubuntu:hirsute" env: CC: gcc + MODE: maintainer + + - container: "ubuntu:hirsute" + env: + ARCH: x86-64 + CC: gcc + MODE: no-maintainer - container: "ubuntu:focal" env: CC: gcc + MODE: maintainer + + - container: "ubuntu:focal" + env: + CC: gcc + MODE: no-maintainer - container: "ubuntu:bionic" env: CC: gcc + MODE: maintainer - container: "ubuntu:xenial" env: CC: gcc + MODE: maintainer # Ubuntu clang - container: "ubuntu:hirsute" env: CC: clang + MODE: maintainer + + - container: "ubuntu:focal" + env: + CC: clang + MODE: maintainer - container: "ubuntu:focal" env: CC: clang + MODE: no-maintainer container: image: ${{ matrix.container }}
@@ -77,7 +99,19 @@ jobs: printenv - name: Configure - run: ./bootstrap-configure + run: | + echo "Bootstraping in mode: $MODE" + if [ "$MODE" = "maintainer" ]; then + ./bootstrap-configure + else + ./bootstrap && \ + ./configure \ + --disable-systemd \ + --prefix=/usr \ + --enable-ese \ + --sysconfdir=/etc \ + --enable-tools + fi - name: Compile run: make -j$(nproc)
Signature · 1 line
2.30.2
PATCH v2 5/11 ci: be verbose when building
In reply to Krzysztof Kozlowski--- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
.github/workflows/ci.yml +3 -1
@@ -102,11 +102,13 @@ jobs: run: | echo "Bootstraping in mode: $MODE" if [ "$MODE" = "maintainer" ]; then - ./bootstrap-configure + ./bootstrap-configure \ + --disable-silent-rules else ./bootstrap && \ ./configure \ --disable-systemd \ + --disable-silent-rules \ --prefix=/usr \ --enable-ese \ --sysconfdir=/etc \
Signature · 1 line
2.30.2
PATCH v2 6/11 ci: add more build configurations (Fedora, Alpine, Debian, cross-compile, i386)
In reply to Krzysztof KozlowskiThe installation scripts were based on LTP project.
--- .github/workflows/ci.yml | 160 ++++++++++++++++++++++++++++++++++++- ci/alpine.sh | 35 ++++++++ ci/debian.cross-compile.sh | 41 ++++++++++ ci/debian.i386.sh | 32 ++++++++ ci/debian.sh | 13 +-- ci/fedora.sh | 33 ++++++++ ci/ubuntu.cross-compile.sh | 1 + ci/ubuntu.i386.sh | 1 + 8 files changed, 309 insertions(+), 7 deletions(-) create mode 100755 ci/alpine.sh create mode 100755 ci/debian.cross-compile.sh create mode 100755 ci/debian.i386.sh create mode 100755 ci/fedora.sh create mode 120000 ci/ubuntu.cross-compile.sh create mode 120000 ci/ubuntu.i386.sh
.github/workflows/ci.yml +158 -2
@@ -20,9 +20,140 @@ jobs: fail-fast: false matrix: include: - # Ubuntu gcc + # Debian builds + # 32bit build + - container: "debian:stable" + env: + ARCH: i386 + CC: gcc -m32 + CROSS_COMPILE: i686-linux-gnu + VARIANT: i386 + MODE: maintainer + + # Debian cross compilation builds + - container: "debian:stable" + env: + ARCH: armel + CC: arm-linux-gnueabi-gcc + CROSS_COMPILE: arm-linux-gnueabi + VARIANT: cross-compile + MODE: maintainer + + - container: "debian:stable" + env: + ARCH: arm64 + CC: aarch64-linux-gnu-gcc + CROSS_COMPILE: aarch64-linux-gnu + VARIANT: cross-compile + MODE: maintainer + + - container: "debian:stable" + env: + ARCH: ppc64el + CC: powerpc64le-linux-gnu-gcc + CROSS_COMPILE: powerpc64le-linux-gnu + VARIANT: cross-compile + MODE: maintainer + + - container: "debian:stable" + env: + ARCH: s390x + CC: s390x-linux-gnu-gcc + CROSS_COMPILE: s390x-linux-gnu + VARIANT: cross-compile + MODE: maintainer + + # Debian gcc + - container: "debian:stable" + env: + ARCH: x86-64 + CC: gcc + MODE: maintainer + + - container: "debian:stable" + env: + ARCH: x86-64 + CC: gcc + MODE: no-maintainer + + - container: "debian:testing" + env: + ARCH: x86-64 + CC: gcc + MODE: maintainer + + - container: "debian:testing" + env: + ARCH: x86-64 + CC: gcc + MODE: no-maintainer + + # Debian clang + - container: "debian:stable" + env: + ARCH: x86-64 + CC: clang + MODE: maintainer + + - container: "debian:stable" + env: + ARCH: x86-64 + CC: clang + MODE: no-maintainer + + - container: "debian:testing" + env: + ARCH: x86-64 + CC: clang + MODE: maintainer + + # musl (native) + - container: "alpine:latest" + env: + ARCH: x86-64 + CC: gcc + MODE: maintainer + + # Fedora + - container: "fedora:latest" + env: + ARCH: x86-64 + CC: gcc + MODE: maintainer + + - container: "fedora:latest" + env: + ARCH: x86-64 + CC: gcc + MODE: no-maintainer + + - container: "fedora:latest" + env: + ARCH: x86-64 + CC: clang + MODE: maintainer + + # Ubuntu 32bit builds: gcc and clang + - container: "ubuntu:hirsute" + env: + ARCH: i386 + CC: gcc -m32 + CROSS_COMPILE: i686-linux-gnu + VARIANT: i386 + MODE: maintainer + + - container: "ubuntu:focal" + env: + ARCH: i386 + CC: gcc -m32 + CROSS_COMPILE: i686-linux-gnu + VARIANT: i386 + MODE: maintainer + + # Ubuntu x86-64 gcc - container: "ubuntu:hirsute" env: + ARCH: x86-64 CC: gcc MODE: maintainer
@@ -34,37 +165,44 @@ jobs: - container: "ubuntu:focal" env: + ARCH: x86-64 CC: gcc MODE: maintainer - container: "ubuntu:focal" env: + ARCH: x86-64 CC: gcc MODE: no-maintainer - container: "ubuntu:bionic" env: + ARCH: x86-64 CC: gcc MODE: maintainer - container: "ubuntu:xenial" env: + ARCH: x86-64 CC: gcc MODE: maintainer - # Ubuntu clang + # Ubuntu x86-64 clang - container: "ubuntu:hirsute" env: + ARCH: x86-64 CC: clang MODE: maintainer - container: "ubuntu:focal" env: + ARCH: x86-64 CC: clang MODE: maintainer - container: "ubuntu:focal" env: + ARCH: x86-64 CC: clang MODE: no-maintainer
@@ -118,8 +256,26 @@ jobs: - name: Compile run: make -j$(nproc) + - name: Check final binary + run: | + file src/neard + ARCH_CHECK="$ARCH" + case "$ARCH" in + armel) ARCH_CHECK="ARM, EABI";; + arm64) ARCH_CHECK="aarch64";; + i386) ARCH_CHECK="Intel 80386";; + ppc64el) ARCH_CHECK="64-bit PowerPC";; + s390x) ARCH_CHECK="IBM S/390";; + *) ARCH_CHECK="x86-64";; + esac + echo "Checking for built matching architecture: $ARCH_CHECK" + file src/neard | grep "$ARCH_CHECK" + - name: Install run: make install - name: Distribution check run: make distcheck + # distcheck runs unit tests so no point for cross compile + # TODO: figure out how to re-configure during distcheck with --host for i386 (DISTCHECK_CONFIGURE_FLAGS) + if: ${{ (matrix.env['ARCH'] == 'x86-64')}}
ci/alpine.sh new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2019-2021 Petr Vorel <[email protected]> +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# + +set -ex + +apk update + +PKGS_CC="gcc" + +# gzip: for distcheck +apk add \ + autoconf \ + autoconf-archive \ + automake \ + gcc \ + gzip \ + dbus-dev \ + glib-dev \ + libnl3-dev \ + libtool \ + make \ + musl-dev \ + $PKGS_CC + +# Packages needed by CI +apk add \ + file + +echo "Install finished: $0"
ci/debian.cross-compile.sh new file +41 -0
41 lines not on this page · raw message
ci/debian.i386.sh new file +32 -0
@@ -0,0 +1,32 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2018-2020 Petr Vorel <[email protected]> +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# + +set -ex + +dpkg --add-architecture i386 +apt update + +# gcc-multilib are also needed for clang 32-bit builds +PKGS_CC="gcc-multilib" + +apt install -y --no-install-recommends \ + linux-libc-dev:i386 + +apt install -y --no-install-recommends \ + autoconf:i386 \ + autoconf-archive \ + automake:i386 \ + libdbus-1-dev:i386 \ + libglib2.0-dev:i386 \ + libnl-3-dev:i386 \ + libnl-genl-3-dev:i386 \ + libtool:i386 \ + $PKGS_CC + +echo "Install finished: $0"
ci/debian.sh +8 -5
@@ -6,7 +6,7 @@ # <[email protected]> # -set -eEx +set -ex apt update
@@ -20,10 +20,11 @@ tzdata tzdata/Zones/Europe select Berlin debconf-set-selections /tmp/tzdata-preseed.txt PKGS_CC="build-essential" -if [ "$CC" = "clang" ]; then - PKGS_CC="clang" -fi - +case $CC in + clang*) + PKGS_CC="clang" + ;; +esac apt install -y --no-install-recommends \ autoconf \
@@ -36,3 +37,5 @@ apt install -y --no-install-recommends \ libtool \ make \ $PKGS_CC + +echo "Install finished: $0"
ci/fedora.sh new file +33 -0
@@ -0,0 +1,33 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# + +set -ex + +PKGS_CC="gcc" +case $CC in + clang*) + PKGS_CC="clang" + ;; +esac + +yum -y install \ + autoconf \ + autoconf-archive \ + automake \ + dbus-devel \ + glib2-devel \ + libnl3-devel \ + libtool \ + make \ + $PKGS_CC + +# Packages needed by CI +yum -y install \ + file + +echo "Install finished: $0"
ci/ubuntu.cross-compile.sh new file +1 -0
@@ -0,0 +1 @@ +debian.cross-compile.sh
ci/ubuntu.i386.sh new file +1 -0
@@ -0,0 +1 @@ +debian.i386.sh
Signature · 1 line
2.30.2
PATCH v2 7/11 ci: run unit tests
In reply to Krzysztof KozlowskiAlthough unit tests are executed as part of distcheck, but add it as a dedicated step to make it explicit with getting the logs afterwards.
--- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+)
.github/workflows/ci.yml +11 -0
@@ -256,6 +256,17 @@ jobs: - name: Compile run: make -j$(nproc) + - name: Run unit tests + id: unit_tests + run: | + make check + if: ${{ (matrix.env['ARCH'] == 'x86-64') || (matrix.env['ARCH'] == 'i386') }} + + - name: Get unit tests logs + run: cat test-suite.log + if: ${{ always() && ((steps.unit_tests.outcome == 'failure') || + (steps.unit_tests.outcome == 'success')) }} + - name: Check final binary run: | file src/neard
Signature · 1 line
2.30.2
PATCH v2 8/11 ci: add build with sanitizers (asan, lsan and ubsan)
In reply to Krzysztof KozlowskiCheck the results if sanitizers were correctly linked.
--- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++-- ci/debian.sanitizers.sh | 18 ++++++++++++++++ ci/ubuntu.sanitizers.sh | 1 + 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100755 ci/debian.sanitizers.sh create mode 120000 ci/ubuntu.sanitizers.sh
.github/workflows/ci.yml +42 -2
@@ -70,6 +70,13 @@ jobs: CC: gcc MODE: maintainer + - container: "debian:stable" + env: + ARCH: x86-64 + CC: gcc + VARIANT: sanitizers + MODE: maintainer + - container: "debian:stable" env: ARCH: x86-64
@@ -82,6 +89,13 @@ jobs: CC: gcc MODE: maintainer + - container: "debian:testing" + env: + ARCH: x86-64 + CC: gcc + VARIANT: sanitizers + MODE: maintainer + - container: "debian:testing" env: ARCH: x86-64
@@ -157,6 +171,13 @@ jobs: CC: gcc MODE: maintainer + - container: "ubuntu:hirsute" + env: + ARCH: x86-64 + CC: gcc + VARIANT: sanitizers + MODE: maintainer + - container: "ubuntu:hirsute" env: ARCH: x86-64
@@ -169,6 +190,13 @@ jobs: CC: gcc MODE: maintainer + - container: "ubuntu:focal" + env: + ARCH: x86-64 + CC: gcc + VARIANT: sanitizers + MODE: maintainer + - container: "ubuntu:focal" env: ARCH: x86-64
@@ -239,9 +267,14 @@ jobs: - name: Configure run: | echo "Bootstraping in mode: $MODE" + CONFIGURE_ARGS="" + if [ "$VARIANT" = "sanitizers" ]; then + CONFIGURE_ARGS="--enable-asan --enable-lsan --enable-ubsan --enable-pie" + fi if [ "$MODE" = "maintainer" ]; then ./bootstrap-configure \ - --disable-silent-rules + --disable-silent-rules \ + $CONFIGURE_ARGS else ./bootstrap && \ ./configure \
@@ -250,7 +283,8 @@ jobs: --prefix=/usr \ --enable-ese \ --sysconfdir=/etc \ - --enable-tools + --enable-tools \ + $CONFIGURE_ARGS fi - name: Compile
@@ -281,6 +315,12 @@ jobs: esac echo "Checking for built matching architecture: $ARCH_CHECK" file src/neard | grep "$ARCH_CHECK" + if [ "$VARIANT" = "sanitizers" ]; then + echo "Checking for linking against sanitizer libraries" + ldd src/neard | grep libasan.so + # liblsan won't appear if asan is used + ldd src/neard | grep libubsan.so + fi - name: Install run: make install
ci/debian.sanitizers.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# + +set -ex + +apt install -y --no-install-recommends \ + liblsan0 \ + libubsan1 + +apt install -y --no-install-recommends libasan6 || \ + apt install -y --no-install-recommends libasan5 + +echo "Install finished: $0"
ci/ubuntu.sanitizers.sh new file +1 -0
@@ -0,0 +1 @@ +debian.sanitizers.sh
Signature · 1 line
2.30.2
PATCH v2 9/11 ci: add CodeQL static analysis
In reply to Krzysztof KozlowskiAdd Github CodeQL static analysis workflow.
--- .github/workflows/codeql-analysis.yml | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml
.github/workflows/codeql-analysis.yml new file +45 -0
@@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2021 Canonical Ltd. +# Author: Krzysztof Kozlowski <[email protected]> +# <[email protected]> +# +name: "CodeQL" +on: [push, pull_request] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout(a)v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init(a)v1 + with: + languages: ${{ matrix.language }} + + - name: Install additional packages + run: sudo ./ci/ubuntu.sh + + - name: Configure + run: ./bootstrap-configure + + - name: Compile + run: | + make -j$(nproc) + make check + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze(a)v1
Signature · 1 line
2.30.2
PATCH v2 10/11 ci: print configure logs on failures
In reply to Krzysztof KozlowskiHelps debugging of container-specific configure failures.
--- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+)
.github/workflows/ci.yml +6 -0
@@ -265,6 +265,7 @@ jobs: printenv - name: Configure + id: configure run: | echo "Bootstraping in mode: $MODE" CONFIGURE_ARGS=""
@@ -287,6 +288,11 @@ jobs: $CONFIGURE_ARGS fi + - name: Get configure logs + run: cat config.log + if: ${{ always() && ((steps.configure.outcome == 'failure') || + (steps.configure.outcome == 'success')) }} + - name: Compile run: make -j$(nproc)
Signature · 1 line
2.30.2
PATCH v2 11/11 ci: use matrix instead of duplicating each build configuration
In reply to Krzysztof KozlowskiUse matrix to list all typical configurations which allows easily to build different distros with clang and maintainer mode. This extends the number of jobs considerably but makes the entire CI YAML file smaller and easier to understand.
--- .github/workflows/ci.yml | 295 ++++++++++++++------------------------- ci/alpine.sh | 9 +- 2 files changed, 114 insertions(+), 190 deletions(-)
.github/workflows/ci.yml +106 -189
@@ -19,229 +19,141 @@ jobs: strategy: fail-fast: false matrix: + arch: [x86-64] + compiler: [gcc, clang] + container: + - alpine:latest + - debian:testing + - debian:stable + - fedora:latest + - ubuntu:hirsute + - ubuntu:focal + - ubuntu:bionic + - ubuntu:xenial + cross_compile: [""] + mode: [maintainer, no-maintainer] + variant: [""] include: - # Debian builds - # 32bit build + # Debian 32-bit builds - container: "debian:stable" - env: - ARCH: i386 - CC: gcc -m32 - CROSS_COMPILE: i686-linux-gnu - VARIANT: i386 - MODE: maintainer - - # Debian cross compilation builds - - container: "debian:stable" - env: - ARCH: armel - CC: arm-linux-gnueabi-gcc - CROSS_COMPILE: arm-linux-gnueabi - VARIANT: cross-compile - MODE: maintainer + arch: i386 + compiler: gcc -m32 + cross_compile: i686-linux-gnu + mode: maintainer + variant: i386 - container: "debian:stable" - env: - ARCH: arm64 - CC: aarch64-linux-gnu-gcc - CROSS_COMPILE: aarch64-linux-gnu - VARIANT: cross-compile - MODE: maintainer + arch: i386 + compiler: gcc -m32 + cross_compile: i686-linux-gnu + mode: no-maintainer + variant: i386 + # Debian cross compilation builds - container: "debian:stable" - env: - ARCH: ppc64el - CC: powerpc64le-linux-gnu-gcc - CROSS_COMPILE: powerpc64le-linux-gnu - VARIANT: cross-compile - MODE: maintainer + arch: armel + compiler: arm-linux-gnueabi-gcc + cross_compile: arm-linux-gnueabi + mode: maintainer + variant: cross-compile - container: "debian:stable" - env: - ARCH: s390x - CC: s390x-linux-gnu-gcc - CROSS_COMPILE: s390x-linux-gnu - VARIANT: cross-compile - MODE: maintainer + arch: arm64 + compiler: aarch64-linux-gnu-gcc + cross_compile: aarch64-linux-gnu + mode: maintainer + variant: cross-compile - # Debian gcc - container: "debian:stable" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer + arch: ppc64el + compiler: powerpc64le-linux-gnu-gcc + cross_compile: powerpc64le-linux-gnu + mode: maintainer + variant: cross-compile - container: "debian:stable" - env: - ARCH: x86-64 - CC: gcc - VARIANT: sanitizers - MODE: maintainer + arch: s390x + compiler: s390x-linux-gnu-gcc + cross_compile: s390x-linux-gnu + mode: maintainer + variant: cross-compile + # Debian GCC sanitizer builds - container: "debian:stable" - env: - ARCH: x86-64 - CC: gcc - MODE: no-maintainer + arch: x86-64 + compiler: gcc + mode: maintainer + variant: sanitizers - container: "debian:testing" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer - - - container: "debian:testing" - env: - ARCH: x86-64 - CC: gcc - VARIANT: sanitizers - MODE: maintainer - - - container: "debian:testing" - env: - ARCH: x86-64 - CC: gcc - MODE: no-maintainer - - # Debian clang - - container: "debian:stable" - env: - ARCH: x86-64 - CC: clang - MODE: maintainer - - - container: "debian:stable" - env: - ARCH: x86-64 - CC: clang - MODE: no-maintainer - - - container: "debian:testing" - env: - ARCH: x86-64 - CC: clang - MODE: maintainer - - # musl (native) - - container: "alpine:latest" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer - - # Fedora - - container: "fedora:latest" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer - - - container: "fedora:latest" - env: - ARCH: x86-64 - CC: gcc - MODE: no-maintainer - - - container: "fedora:latest" - env: - ARCH: x86-64 - CC: clang - MODE: maintainer - - # Ubuntu 32bit builds: gcc and clang - - container: "ubuntu:hirsute" - env: - ARCH: i386 - CC: gcc -m32 - CROSS_COMPILE: i686-linux-gnu - VARIANT: i386 - MODE: maintainer - - - container: "ubuntu:focal" - env: - ARCH: i386 - CC: gcc -m32 - CROSS_COMPILE: i686-linux-gnu - VARIANT: i386 - MODE: maintainer - - # Ubuntu x86-64 gcc - - container: "ubuntu:hirsute" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer + arch: x86-64 + compiler: gcc + mode: maintainer + variant: sanitizers + # Ubuntu 32-bit builds - container: "ubuntu:hirsute" - env: - ARCH: x86-64 - CC: gcc - VARIANT: sanitizers - MODE: maintainer + arch: i386 + compiler: gcc -m32 + cross_compile: i686-linux-gnu + mode: maintainer + variant: i386 - container: "ubuntu:hirsute" - env: - ARCH: x86-64 - CC: gcc - MODE: no-maintainer - - - container: "ubuntu:focal" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer + arch: i386 + compiler: gcc -m32 + cross_compile: i686-linux-gnu + mode: no-maintainer + variant: i386 - container: "ubuntu:focal" - env: - ARCH: x86-64 - CC: gcc - VARIANT: sanitizers - MODE: maintainer + arch: i386 + compiler: gcc -m32 + cross_compile: i686-linux-gnu + mode: maintainer + variant: i386 - container: "ubuntu:focal" - env: - ARCH: x86-64 - CC: gcc - MODE: no-maintainer - - - container: "ubuntu:bionic" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer + arch: i386 + compiler: gcc -m32 + cross_compile: i686-linux-gnu + mode: no-maintainer + variant: i386 - - container: "ubuntu:xenial" - env: - ARCH: x86-64 - CC: gcc - MODE: maintainer - - # Ubuntu x86-64 clang + # Ubuntu GCC sanitizer builds - container: "ubuntu:hirsute" - env: - ARCH: x86-64 - CC: clang - MODE: maintainer - - - container: "ubuntu:focal" - env: - ARCH: x86-64 - CC: clang - MODE: maintainer + arch: x86-64 + compiler: gcc + mode: maintainer + variant: sanitizers - container: "ubuntu:focal" - env: - ARCH: x86-64 - CC: clang - MODE: no-maintainer + arch: x86-64 + compiler: gcc + mode: maintainer + variant: sanitizers container: image: ${{ matrix.container }} - env: ${{ matrix.env }} + env: + ARCH: ${{ matrix.arch }} + CC: ${{ matrix.compiler }} + CROSS_COMPILE: ${{ matrix.cross_compile }} + MODE: ${{ matrix.mode }} + VARIANT: ${{ matrix.variant }} steps: - name: Show OS run: cat /etc/os-release + - name: Show env (matrix settings) + run: | + echo "ARCH: $ARCH" + echo "CC: $CC" + echo "CROSS_COMPILE: $CROSS_COMPILE" + echo "MODE: $MODE" + echo "VARIANT: $VARIANT" + - name: Git checkout uses: actions/checkout(a)v2
@@ -272,11 +184,16 @@ jobs: if [ "$VARIANT" = "sanitizers" ]; then CONFIGURE_ARGS="--enable-asan --enable-lsan --enable-ubsan --enable-pie" fi + CONFIGURE_CROSS="" + if [ "$CROSS_COMPILE" ]; then + CONFIGURE_CROSS="--host=${CROSS_COMPILE}" + fi if [ "$MODE" = "maintainer" ]; then ./bootstrap-configure \ --disable-silent-rules \ $CONFIGURE_ARGS else + CONFIGURE_ARGS="$CONFIGURE_ARGS $CONFIGURE_CROSS" ./bootstrap && \ ./configure \ --disable-systemd \
@@ -300,7 +217,7 @@ jobs: id: unit_tests run: | make check - if: ${{ (matrix.env['ARCH'] == 'x86-64') || (matrix.env['ARCH'] == 'i386') }} + if: ${{ (matrix.arch == 'x86-64') || (matrix.arch == 'i386') }} - name: Get unit tests logs run: cat test-suite.log
@@ -335,4 +252,4 @@ jobs: run: make distcheck # distcheck runs unit tests so no point for cross compile # TODO: figure out how to re-configure during distcheck with --host for i386 (DISTCHECK_CONFIGURE_FLAGS) - if: ${{ (matrix.env['ARCH'] == 'x86-64')}} + if: ${{ (matrix.arch == 'x86-64')}}
ci/alpine.sh +8 -1
@@ -12,13 +12,20 @@ set -ex apk update PKGS_CC="gcc" +case $CC in + clang*) + # On Alpine v3.14 clang fails without gcc: + # cannot find crtbeginS.o: No such file or directory + PKGS_CC="clang gcc" + ;; +esac # gzip: for distcheck apk add \ autoconf \ autoconf-archive \ automake \ - gcc \ + binutils \ gzip \ dbus-dev \ glib-dev \
Signature · 1 line
2.30.2
Mark Greer
AppliedQuoted 12 lines · Krzysztof Kozlowski
Hi,
Add a Continuous Integration builds under Github (with its Actions) to build and unit test on several configurations.
Changes since v1 [1]:
1. Rebase on latest master.
2. Remove CI-unrelated patches from this set.
3. Add CodeQL analysis.
4. Add builds and tests with GCC sanitizers.
5. Use matrix to extend the build configuration.
Quoted 5 lines
[1] https://lore.kernel.org/linux-nfc/20210710033859.3989-1-krzysztof.kozlowski(a)canonical.com/
Best regards,
Krzysztof
Applied.
Thank you.
Mark
--