Skip to content

Build and on Linux #134

Build and on Linux

Build and on Linux #134

Workflow file for this run

# Copyright (c) 2023 Sebastian Pipping <[email protected]>
# SPDX-License-Identifier: BSD-2-Clause
name: Build and on Linux
# Drop permissions to minimum, for security
permissions:
contents: read
on:
pull_request:
push:
schedule:
- cron: '0 3 * * 5' # Every Friday at 3am
jobs:
linux:
name: Build (${{ matrix.cc }})
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- cc: gcc-11
cxx: g++-11
clang_major_version: null
clang_repo_suffix: null
runs-on: ubuntu-22.04
- cc: gcc-12
cxx: g++-12
clang_major_version: null
clang_repo_suffix: null
runs-on: ubuntu-22.04
- cc: clang-15
cxx: clang++-15
clang_major_version: 15
clang_repo_suffix: -15
runs-on: ubuntu-22.04
- cc: clang-16
cxx: clang++-16
clang_major_version: 16
clang_repo_suffix: -16
runs-on: ubuntu-22.04
- cc: clang-17
cxx: clang++-17
clang_major_version: 17
clang_repo_suffix:
runs-on: ubuntu-22.04
steps:
- name: Add Clang/LLVM repositories
if: "${{ contains(matrix.cxx, '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 https://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 \
bison \
libpam0g-dev
- name: Install build dependency Clang ${{ matrix.clang_major_version }}
if: "${{ contains(matrix.cxx, 'clang') }}"
run: |-
sudo apt-get install --yes --no-install-recommends -V \
clang-${{ matrix.clang_major_version }}
- name: Checkout Git branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 'Build'
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: -std=c99 -Wextra -pedantic
LDFLAGS: -Wl,--as-needed
YACC: bison --yacc
run: |-
make
- name: 'Install'
run: |-
set -x -o pipefail
make install DESTDIR="${PWD}"/ROOT/
find ROOT/ | sort | xargs ls -ld
- name: 'Uninstall'
run: |-
set -x
make uninstall DESTDIR="${PWD}"/ROOT/
[[ "$(find ROOT/ -not -type d | tee /dev/stderr)" == '' ]] # i.e. fail CI if leftover files
- name: 'Smoke test'
run: |-
set -x
sudo chown root:root ./doas
sudo chmod u+s ./doas
sudo tee -a /usr/local/etc/doas.conf <<<"permit nopass ${USER} as nobody"
[[ "$(./doas -u nobody id -u -n)" == nobody ]]
- name: 'Clean'
run: |-
set -x -o pipefail
make clean
[[ "$(git ls-files -o | tee /dev/stderr | wc -l)" -eq 0 ]]