]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add MacOS to Github Actions CI tests (#1785)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Mon, 29 Apr 2024 21:28:23 +0000 (21:28 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 29 Apr 2024 22:42:13 +0000 (22:42 +0000)
Add MacOS/homebrew as a target platform for the GitHub CI tests.
Also improve detection of the number of available cores in buildtests.sh

.github/workflows/default.yaml
test-suite/buildtest.sh

index d926161d6ee017c3876ab075c377bf2db9c1d899..898db8b97917078d525b02042e3a7696b093d51b 100644 (file)
@@ -94,7 +94,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        os: [ ubuntu-22.04 ]
+        os: [ ubuntu-22.04, macos-14 ]
 
     runs-on: ${{ matrix.os }}
 
@@ -109,10 +109,38 @@ jobs:
           sudo apt-get --quiet=2 build-dep squid
           sudo apt-get --quiet=2 install linuxdoc-tools libtool-bin
 
+      - name: Install prerequisite MacOS packages
+        if: runner.os == 'macOS'
+        run: |
+          brew install \
+            automake coreutils cppunit gawk \
+            gnu-getopt gnu-sed grep libtool \
+            make openldap openssl cyrus-sasl
+
       - name: Checkout sources
         uses: actions/checkout@v4
 
-      - run: ./test-builds.sh
+      - name: Run build on Linux
+        if: runner.os == 'Linux'
+        run: ./test-builds.sh
+
+      - name: Run build on MacOS
+        if: runner.os == 'macOS'
+        run: |
+          eval `brew shellenv`
+          PKG_CONFIG_PATH="$HOMEBREW_PREFIX/lib/pkgconfig"
+          PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openldap/lib/pkgconfig"
+          PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/cyrus-sasl/lib/pkgconfig"
+          export PKG_CONFIG_PATH
+          export GETOPT="$HOMEBREW_PREFIX/opt/gnu-getopt/bin/getopt"
+          export MAKE="$HOMEBREW_PREFIX/bin/gmake"
+          # ensure we use Homebrew headers and libraries
+          # this is needed because pkg-config --libs openssl points to the wrong directory
+          #   in version openssl@3: stable 3.3.0
+          export CPPFLAGS="-I$HOMEBREW_PREFIX/include${CPPFLAGS:+ $CPPFLAGS}"
+          export LDFLAGS="-L$HOMEBREW_PREFIX/lib${LDFLAGS:+ $LDFLAGS}"
+          export CFLAGS="-Wno-compound-token-split-by-macro${CFLAGS:+ $CFLAGS}" # needed fir ltdl with Xcode
+          ./test-builds.sh
 
       - name: Publish build logs
         if: success() || failure()
index 089cbc7829cf256cc965695d5ad9a49e06c0d256..0c3ab21b56d8993ae5dfe19dd4bf410541055068 100755 (executable)
@@ -22,19 +22,23 @@ if [ -n "$cache_file" ]; then
     configcache="--cache-file=$cache_file"
 fi
 
-#if we are on Linux, let's try parallelizing
+# let's try parallelizing
+if [ -z "$pjobs" ] && nproc > /dev/null 2>&1 ; then
+    ncpus=`nproc`
+    pjobs="-j${ncpus}"
+fi
 if [ -z "$pjobs" -a -e /proc/cpuinfo ]; then
     ncpus=`grep '^processor' /proc/cpuinfo | tail -1|awk '{print $3}'`
     ncpus=`expr ${ncpus} + 1`
     pjobs="-j${ncpus}"
 fi
-#if we are on FreeBSD, let's try parallelizing
 if [ -z "$pjobs" -a -x /sbin/sysctl ]; then
     ncpus=`sysctl kern.smp.cpus | cut -f2 -d" "`
     if [ $? -eq 0 -a -n "$ncpus" -a "$ncpus" -gt 1 ]; then
         pjobs="-j${ncpus}"
     fi
 fi
+echo "pjobs: $pjobs"
 
 if test -e ${config} ; then
        echo "BUILD: ${config}"