| # SPDX-License-Identifier: GPL-2.0 |
| # |
| # Copyright (c) 2021 Canonical Ltd. |
| # Copyright (c) 2023 Linaro Ltd. |
| # Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> |
| # <krzk@kernel.org> |
| # Loosely based on https://github.com/linux-test-project/ltp |
| # |
| name: "Builds" |
| on: |
| pull_request: |
| push: |
| schedule: |
| # Run at 1:01 AM, every Tuesday |
| - cron: '1 1 * * 2' |
| workflow_dispatch: |
| |
| jobs: |
| job: |
| name: Build |
| runs-on: ubuntu-latest |
| permissions: |
| actions: read |
| contents: read |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| arch: [x86-64] |
| compiler: [gcc, clang] |
| container: |
| - alpine:latest |
| - archlinux:latest |
| - debian:testing |
| - debian:stable |
| - debian:bookworm |
| - debian:bullseye |
| - debian:buster |
| # Fails on configure on GCC and clang (process restrictions?) |
| # - fedora:rawhide |
| - fedora:latest |
| - fedora:39 |
| - fedora:38 |
| - fedora:37 |
| - fedora:36 |
| - fedora:35 |
| - fedora:34 |
| - ubuntu:lunar |
| - ubuntu:kinetic |
| - ubuntu:jammy |
| - ubuntu:focal |
| - ubuntu:bionic |
| - ubuntu:xenial |
| cross_compile: [""] |
| mode: [maintainer, no-maintainer] |
| variant: [""] |
| include: |
| # Debian 32-bit builds |
| - container: "debian:testing" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: maintainer |
| variant: i386 |
| |
| - container: "debian:testing" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: no-maintainer |
| variant: i386 |
| |
| - container: "debian:stable" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: maintainer |
| variant: i386 |
| |
| - container: "debian:stable" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: no-maintainer |
| variant: i386 |
| |
| - container: "debian:bookworm" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: maintainer |
| variant: i386 |
| |
| - container: "debian:bookworm" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: no-maintainer |
| variant: i386 |
| |
| - container: "debian:buster" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: maintainer |
| variant: i386 |
| |
| - container: "debian:buster" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: no-maintainer |
| variant: i386 |
| |
| # Debian cross compilation builds |
| - container: "debian:testing" |
| arch: armel |
| compiler: arm-linux-gnueabi-gcc |
| cross_compile: arm-linux-gnueabi |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:testing" |
| arch: arm64 |
| compiler: aarch64-linux-gnu-gcc |
| cross_compile: aarch64-linux-gnu |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:testing" |
| arch: ppc64el |
| compiler: powerpc64le-linux-gnu-gcc |
| cross_compile: powerpc64le-linux-gnu |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:testing" |
| arch: s390x |
| compiler: s390x-linux-gnu-gcc |
| cross_compile: s390x-linux-gnu |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:stable" |
| arch: armel |
| compiler: arm-linux-gnueabi-gcc |
| cross_compile: arm-linux-gnueabi |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:stable" |
| arch: arm64 |
| compiler: aarch64-linux-gnu-gcc |
| cross_compile: aarch64-linux-gnu |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:stable" |
| arch: ppc64el |
| compiler: powerpc64le-linux-gnu-gcc |
| cross_compile: powerpc64le-linux-gnu |
| mode: maintainer |
| variant: cross-compile |
| |
| - container: "debian:stable" |
| arch: s390x |
| compiler: s390x-linux-gnu-gcc |
| cross_compile: s390x-linux-gnu |
| mode: maintainer |
| variant: cross-compile |
| |
| # Debian GCC sanitizer builds |
| - container: "debian:testing" |
| arch: x86-64 |
| compiler: gcc |
| mode: maintainer |
| variant: sanitizers |
| |
| - container: "debian:stable" |
| arch: x86-64 |
| compiler: gcc |
| mode: maintainer |
| variant: sanitizers |
| |
| - container: "debian:bookworm" |
| arch: x86-64 |
| compiler: gcc |
| mode: maintainer |
| variant: sanitizers |
| |
| - container: "debian:buster" |
| arch: x86-64 |
| compiler: gcc |
| mode: maintainer |
| variant: sanitizers |
| |
| # Ubuntu 32-bit builds |
| - container: "ubuntu:jammy" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: maintainer |
| variant: i386 |
| |
| - container: "ubuntu:jammy" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: no-maintainer |
| variant: i386 |
| |
| - container: "ubuntu:focal" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: maintainer |
| variant: i386 |
| |
| - container: "ubuntu:focal" |
| arch: i386 |
| compiler: gcc -m32 |
| cross_compile: i686-linux-gnu |
| mode: no-maintainer |
| variant: i386 |
| |
| # Ubuntu GCC sanitizer builds |
| - container: "ubuntu:jammy" |
| arch: x86-64 |
| compiler: gcc |
| mode: maintainer |
| variant: sanitizers |
| |
| - container: "ubuntu:focal" |
| arch: x86-64 |
| compiler: gcc |
| mode: maintainer |
| variant: sanitizers |
| |
| container: |
| image: ${{ matrix.container }} |
| 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@v3 |
| |
| - 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 |
| echo "############################################" |
| lsb_release -a || true |
| echo "############################################" |
| cat /usr/include/linux/version.h |
| echo "############################################" |
| uname -a |
| echo "############################################" |
| cat /proc/cmdline |
| echo "############################################" |
| printenv |
| |
| - name: Display nfc.h differences between local and Linux kernel headers |
| run: diff -uBb /usr/include/linux/nfc.h include/nfc_copy.h || true |
| |
| - name: Configure |
| id: configure |
| run: | |
| echo "Bootstraping in mode: $MODE" |
| CONFIGURE_ARGS="" |
| 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 \ |
| --disable-silent-rules \ |
| --prefix=/usr \ |
| --enable-ese \ |
| --sysconfdir=/etc \ |
| --enable-tools \ |
| $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) |
| |
| - name: Run unit tests |
| id: unit_tests |
| run: | |
| make check |
| if: ${{ (matrix.arch == 'x86-64') || (matrix.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 |
| 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" |
| 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 |
| |
| - 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.arch == 'x86-64')}} |