Build on Linux #3
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
# Copyright (c) 2024 Sebastian Pipping <[email protected]> | |
# Licensed under GPL v2 or later | |
name: Build on Linux | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '0 3 * * 5' # Every Friday at 3am | |
workflow_dispatch: | |
# Minimum permissions for security | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
name: Build (${{ matrix.cc }}) | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cc: gcc-13 | |
cxx: g++-13 | |
clang_major_version: null | |
clang_repo_suffix: null | |
runs-on: ubuntu-22.04 | |
- cc: clang-17 | |
cxx: clang++-17 | |
clang_major_version: 17 | |
clang_repo_suffix: -17 | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Git branch | |
uses: actions/checkout@v4 | |
- name: Add Clang/LLVM repositories | |
if: "${{ contains(matrix.cc, 'clang') }}" | |
run: |- | |
set -x | |
source /etc/os-release | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}${{ matrix.clang_repo_suffix }} main" | |
- name: Install build dependencies | |
run: |- | |
sudo apt-get update | |
sudo apt-get install --yes --no-install-recommends \ | |
libaudit-dev \ | |
libpam0g-dev \ | |
libselinux1-dev | |
- name: Install build dependency Clang ${{ matrix.clang_major_version }} | |
if: "${{ contains(matrix.cc, 'clang') }}" | |
run: |- | |
sudo apt-get install --yes --no-install-recommends -V \ | |
clang-${{ matrix.clang_major_version }} | |
- name: 'Bootstrap' | |
run: |- | |
./autogen.sh | |
- name: 'Configure' | |
env: | |
CFLAGS: '-std=gnu99 -Wall -Wextra -pedantic -O1 -pipe' | |
LDFLAGS: '-Wl,--as-needed' | |
run: |- | |
set -x | |
mkdir build | |
cd build | |
configure_args=( | |
# Make build logs better explain themselves | |
--disable-silent-rules | |
# Enable more optional features to increase coverage | |
--enable-syscrontab | |
--with-audit | |
--with-inotify | |
--with-pam | |
--with-selinux | |
) | |
../configure "${configure_args[@]}" | |
- name: 'Make' | |
run: |- | |
make -C build -j$(nproc) | |
- name: 'Install' | |
run: |- | |
set -x -o pipefail | |
make -C build install DESTDIR="${PWD}"/ROOT/ | |
find ROOT/ | sort | xargs ls -ld | |
- name: 'Distcheck' | |
run: |- | |
set -x | |
make -C build distcheck |