-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6b5997
commit 07f9936
Showing
10 changed files
with
471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,257 @@ | ||
# 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 | ||
- name: Disable systemd | ||
if: ${{ matrix.nosystemd == true }} | ||
run: | | ||
touch .nosystemd | ||
# i386 build on x86_64 only requires passing -m32 to CFLAGS & LDFLAGS | ||
- name: Meson init for i386 | ||
if: ${{ matrix.variant == 'i386' }} | ||
run: | | ||
if [ -f .nosystemd ]; then export BUILD_OPTIONS="-Dsystemd-service=disabled"; fi | ||
mkdir build | ||
CFLAGS="-m32" LDFLAGS="-m32" meson setup $BUILD_OPTIONS --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 | ||
export BUILD_OPTIONS="-Dsystemd-service=disabled"; | ||
# 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 $BUILD_OPTIONS --errorlogs --werror --cross-file cross.txt . build | ||
- name: Meson init | ||
if: ${{ matrix.variant == '' }} | ||
run: | | ||
if [ -f .nosystemd ]; then export BUILD_OPTIONS="-Dsystemd-service=disabled"; fi | ||
mkdir build | ||
meson setup $BUILD_OPTIONS --errorlogs --werror . build | ||
- name: Compile | ||
run: ninja -C build | ||
|
||
- name: Install | ||
run: ninja -C build install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Copyright (c) 2021 Canonical Ltd. | ||
# Copyright (c) 2023 Linaro Ltd | ||
# Author: Krzysztof Kozlowski <[email protected]> | ||
# <[email protected]> | ||
# | ||
name: "CodeQL" | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'cpp' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Install additional packages | ||
run: sudo ./ci/ubuntu.sh | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Copyright (c) 2021 Canonical Ltd. | ||
# Copyright (c) 2023 Linaro Ltd | ||
# Author: Krzysztof Kozlowski <[email protected]> | ||
# <[email protected]> | ||
# | ||
|
||
set -ex | ||
|
||
PKGS_CC="gcc" | ||
case $CC in | ||
clang*) | ||
PKGS_CC="clang" | ||
;; | ||
esac | ||
|
||
apk add \ | ||
linux-headers \ | ||
meson \ | ||
musl-dev \ | ||
libc-dev \ | ||
$PKGS_CC | ||
|
||
echo "Install finished: $0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Copyright (c) 2021 Canonical Ltd. | ||
# Copyright (c) 2023 Linaro Ltd | ||
# Author: Krzysztof Kozlowski <[email protected]> | ||
# <[email protected]> | ||
# | ||
|
||
set -ex | ||
|
||
PKGS_CC="gcc" | ||
case $CC in | ||
clang*) | ||
PKGS_CC="clang" | ||
;; | ||
esac | ||
|
||
pacman -Syu --noconfirm \ | ||
systemd-libs \ | ||
pkgconf \ | ||
meson \ | ||
$PKGS_CC | ||
|
||
echo "Install finished: $0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Copyright (c) 2018-2020 Petr Vorel <[email protected]> | ||
# Copyright (c) 2021 Canonical Ltd. | ||
# Copyright (c) 2023 Linaro Ltd | ||
# Author: Krzysztof Kozlowski <[email protected]> | ||
# <[email protected]> | ||
# | ||
|
||
set -ex | ||
|
||
if [ -z "$ARCH" ]; then | ||
echo "missing \$ARCH!" >&2 | ||
exit 1 | ||
fi | ||
|
||
dpkg --add-architecture $ARCH | ||
apt update | ||
|
||
apt install -y --no-install-recommends \ | ||
libc6-dev:${ARCH} \ | ||
gcc-`dpkg-architecture -a ${ARCH} -q DEB_TARGET_GNU_TYPE` | ||
|
||
# Thanks debian | ||
apt install -y --no-install-recommends systemd-dev:${ARCH} -a ${ARCH} || true | ||
|
||
echo "Install finished: $0" |
Oops, something went wrong.