From bb870cb98fd6885b2e1d1c6ae0af5b1c32663d8a Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sat, 1 Feb 2025 08:07:24 +0100 Subject: [PATCH] Add FreeBSD CI build Signed-off-by: Toni Uhlig --- .github/workflows/build-freebsd.yml | 39 +++++++++++++++++++++++++++++ .github/workflows/sonarcloud.yml | 2 +- scripts/get-and-build-libndpi.sh | 7 +++--- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-freebsd.yml diff --git a/.github/workflows/build-freebsd.yml b/.github/workflows/build-freebsd.yml new file mode 100644 index 00000000..1dc5ac27 --- /dev/null +++ b/.github/workflows/build-freebsd.yml @@ -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 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 1aba3721..5c92e73f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -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 diff --git a/scripts/get-and-build-libndpi.sh b/scripts/get-and-build-libndpi.sh index d1d74905..ef4db7e2 100755 --- a/scripts/get-and-build-libndpi.sh +++ b/scripts/get-and-build-libndpi.sh @@ -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; }