mirror of
https://github.com/slicer69/doas
synced 2024-10-02 22:25:19 +00:00
Merge pull request #112 from hartwork/github-actions-linux-ci
Make GitHub Actions build and smoke test on Linux
This commit is contained in:
commit
4bba105ec0
15
.github/dependabot.yml
vendored
Normal file
15
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
commit-message:
|
||||
include: "scope"
|
||||
prefix: "Actions"
|
||||
directory: "/"
|
||||
labels:
|
||||
- "enhancement"
|
||||
schedule:
|
||||
interval: "weekly"
|
108
.github/workflows/linux.yml
vendored
Normal file
108
.github/workflows/linux.yml
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
# Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
# 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@v3
|
||||
|
||||
- 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 ]]
|
4
doas.c
4
doas.c
|
@ -420,7 +420,7 @@ main(int argc, char **argv)
|
|||
pam_handle_t *pamh = NULL;
|
||||
int pam_err;
|
||||
|
||||
/* #ifndef linux */
|
||||
/* #ifndef __linux__ */
|
||||
int temp_stdin;
|
||||
|
||||
/* openpam_ttyconv checks if stdin is a terminal and
|
||||
|
@ -497,7 +497,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
pam_end(pamh, pam_err);
|
||||
|
||||
#ifndef linux
|
||||
#ifndef __linux__
|
||||
/* Re-establish stdin */
|
||||
if (dup2(temp_stdin, STDIN_FILENO) == -1)
|
||||
err(1, "dup2");
|
||||
|
|
Loading…
Reference in a new issue