Add FreeBSD CI build

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2025-02-01 08:07:24 +01:00
parent e262227d65
commit bb870cb98f
3 changed files with 44 additions and 4 deletions

39
.github/workflows/build-freebsd.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: FreeBSD Build
on:
schedule:
# At the end of every day
- cron: '0 0 * * *'
push:
branches:
- main
- tmp
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
release:
types: [created]
jobs:
test:
runs-on: ubuntu-latest
name: Build and Test
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y bash autoconf automake cmake gmake libtool gettext pkgconf gcc \
git wget unzip flock \
json-c flex bison libpcap curl openssl dbus
run: |
echo "Working Directory: $(pwd)"
echo "User.............: $(whoami)"
echo "FreeBSD Version..: $(freebsd-version)"
# TODO: Make examples I/O event agnostic i.e. use nio
cmake -S . -B build -DBUILD_NDPI=ON -DBUILD_EXAMPLES=OFF #-DENABLE_CURL=ON -DENABLE_DBUS=ON
cmake --build build

View File

@@ -24,7 +24,7 @@ jobs:
run: |
pip install gcovr==5.0 # 5.1 is not supported
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v3.1.0
uses: SonarSource/sonarcloud-github-c-cpp@v3.2.0
- name: Install Prerequisites
run: |
sudo apt-get update

View File

@@ -6,6 +6,7 @@ GIT_EXEC="$(command -v git || printf '%s' "")"
WGET_EXEC="$(command -v wget || printf '%s' "")"
UNZIP_EXEC="$(command -v unzip || printf '%s' "")"
MAKE_EXEC="$(command -v make || printf '%s' "")"
FLOCK_EXEC="$(command -v flock || printf '%s' "")"
if [ -z "${NDPI_COMMIT_HASH}" ]; then
NDPI_COMMIT_HASH="dev"
@@ -14,15 +15,15 @@ else
GITHUB_FALLBACK_URL="https://github.com/ntop/nDPI/archive/${NDPI_COMMIT_HASH}.zip"
fi
if [ -z "${GIT_EXEC}" -o -z "${WGET_EXEC}" -o -z "${UNZIP_EXEC}" -o -z "${MAKE_EXEC}" ]; then
printf '%s\n' "Required Executables missing: git, wget, unzip, make" >&2
if [ -z "${GIT_EXEC}" -o -z "${WGET_EXEC}" -o -z "${UNZIP_EXEC}" -o -z "${MAKE_EXEC}" -o -z "${FLOCK_EXEC}" ]; then
printf '%s\n' "Required Executables missing: git, wget, unzip, make, flock" >&2
exit 1
fi
LOCKFILE="$(realpath "${0}").lock"
touch "${LOCKFILE}"
exec 42< "${LOCKFILE}"
flock -x -n 42 || {
${FLOCK_EXEC} -x -n 42 || {
printf '%s\n' "Could not aquire file lock for ${0}. Already running instance?" >&2;
exit 1;
}