Skip to content

Builds

Builds #37

Workflow file for this run

# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Copyright (c) 2023 Linaro Ltd
# Author: Krzysztof Kozlowski <[email protected]>
# <[email protected]>
#
# Loosely based on: https://github.com/linux-test-project/ltp
# https://github.com/linux-nfc/neard
#
name: "Builds"
on:
pull_request:
push:
schedule:
# Run at 1:01 PM, every Tuesday
- cron: '1 13 * * 2'
workflow_dispatch:
jobs:
job:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix:
arch: [x86-64]
family: [x86-64]
compiler: [gcc, clang]
container:
- archlinux:latest
- debian:testing
- debian:stable
- debian:bookworm
- debian:bullseye
# Fails on configure on GCC and clang (process restrictions?)
# - fedora:rawhide
- fedora:latest
- fedora:39
- fedora:38
- fedora:37
- ubuntu:lunar # EOL 01.2024
- ubuntu:jammy
- ubuntu:focal
# On Ubuntu Bionic the Meson doesn't support feature options
#- ubuntu:bionic
# Meson version on Ubuntu Xenial is really too old
#- ubuntu:xenial
cross_compile: [""]
variant: [""]
nosystemd: [""]
include:
# Alpine (OpenRC)
- container: "alpine:edge"
arch: x86-64
family: x86-64
compiler: gcc
nosystemd: true
- container: "alpine:latest"
arch: x86-64
family: x86-64
compiler: gcc
nosystemd: true
# Debian 32-bit builds
- container: "debian:testing"
arch: i386
family: x86
compiler: gcc
cross_compile: i686-linux-gnu
pkg_config_path: /usr/lib/i386-linux-gnu/pkgconfig
variant: i386
- container: "debian:stable"
arch: i386
family: x86
compiler: gcc
cross_compile: i686-linux-gnu
pkg_config_path: /usr/lib/i386-linux-gnu/pkgconfig
variant: i386
- container: "debian:bookworm"
arch: i386
family: x86
compiler: gcc
cross_compile: i686-linux-gnu
pkg_config_path: /usr/lib/i386-linux-gnu/pkgconfig
variant: i386
# Debian cross compilation builds
- container: "debian:testing"
arch: armhf
family: arm
compiler: arm-linux-gnueabihf-gcc
cross_compile: arm-linux-gnueabihf
pkg_config_path: /usr/lib/arm-linux-gnueabihf/pkgconfig
variant: cross-compile
- container: "debian:testing"
arch: arm64
family: aarch64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
pkg_config_path: /usr/lib/aarch64-linux-gnu/pkgconfig
variant: cross-compile
- container: "debian:testing"
arch: ppc64el
family: ppc64
compiler: powerpc64le-linux-gnu-gcc
cross_compile: powerpc64le-linux-gnu
pkg_config_path: /usr/lib/powerpc64le-linux-gnu/pkgconfig
variant: cross-compile
- container: "debian:testing"
arch: s390x
family: s390x
compiler: s390x-linux-gnu-gcc
cross_compile: s390x-linux-gnu
pkg_config_path: /usr/lib/s390x-linux-gnu/pkgconfig
variant: cross-compile
- container: "debian:stable"
arch: armhf
family: arm
compiler: arm-linux-gnueabihf-gcc
cross_compile: arm-linux-gnueabihf
pkg_config_path: /usr/lib/arm-linux-gnueabihf/pkgconfig
variant: cross-compile
- container: "debian:stable"
arch: arm64
family: aarch64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
pkg_config_path: /usr/lib/aarch64-linux-gnu/pkgconfig
variant: cross-compile
- container: "debian:stable"
arch: ppc64el
family: ppc64
compiler: powerpc64le-linux-gnu-gcc
cross_compile: powerpc64le-linux-gnu
pkg_config_path: /usr/lib/powerpc64le-linux-gnu/pkgconfig
variant: cross-compile
- container: "debian:stable"
arch: s390x
family: s390x
compiler: s390x-linux-gnu-gcc
cross_compile: s390x-linux-gnu
pkg_config_path: /usr/lib/s390x-linux-gnu/pkgconfig
variant: cross-compile
container:
image: ${{ matrix.container }}
env:
ARCH: ${{ matrix.arch }}
FAMILY: ${{ matrix.family }}
CC: ${{ matrix.compiler }}
CROSS_COMPILE: ${{ matrix.cross_compile }}
PKG_CONFIG_PATH: ${{ matrix.pkg_config_path }}
VARIANT: ${{ matrix.variant }}
steps:
- name: Show OS
run: cat /etc/os-release
- name: Show env (matrix settings)
run: |
echo "ARCH: $ARCH"
echo "FAMILY: $FAMILY"
echo "CC: $CC"
echo "CROSS_COMPILE: $CROSS_COMPILE"
echo "VARIANT: $VARIANT"
echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
- 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
# i386 build on x86_64 only requires passing -m32 to CFLAGS & LDFLAGS
- name: Meson init for i386
if: ${{ matrix.variant == 'i386' }}
run: |
mkdir build
CFLAGS="-m32" LDFLAGS="-m32" meson setup --errorlogs --werror . build
- name: Meson init with cross compile
if: ${{ matrix.variant == 'cross-compile' }}
run: |
# installing systemd (for pkg-config) has personality issues with cross-compilation
# Generate cross compile file (see https://mesonbuild.com/Cross-compilation.html#cross-compilation)
echo "[binaries]" > cross.txt
echo "c = '${CROSS_COMPILE}-gcc'" >> cross.txt
echo "strip = '${CROSS_COMPILE}-strip'" >> cross.txt
# Forcing pkgconfig binary to 'pkg-config' is required for cross build to work
echo "pkgconfig = 'pkg-config'" >> cross.txt
echo "[host_machine]" >> cross.txt
echo "system = 'linux'" >> cross.txt
echo "cpu_family = '${FAMILY}'" >> cross.txt
echo "cpu = '${ARCH}'" >> cross.txt
echo "endian = 'little'" >> cross.txt
echo "[properties]" >> cross.txt
echo "pkg_config_libdir = '${PKG_CONFIG_PATH}'" >> cross.txt
cat cross.txt
mkdir build
meson setup --errorlogs --werror --cross-file cross.txt . build
- name: Meson init
if: ${{ matrix.variant == '' }}
run: |
mkdir build
meson setup --errorlogs --werror . build
- name: Compile
run: ninja -C build
- name: Install
run: ninja -C build install