From 4dd0f3a32214568e6f20aefdfe8716ccf7071fca Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 11 Nov 2022 10:19:43 +0100 Subject: ci: Add CI build for macOS Note that this skips the 'make distcheck' stage due to two reasons: * GitHub considers macOS cpu cycles to be very expensive, and distcheck basically doubles the build cycles * For reasons yet unknown, 'make distcheck' on macOS fails with the compiler being unable to create an executable. --- .github/workflows/ccpp.yml | 51 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 9 deletions(-) (limited to '.github') diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 78fde909b..e6edb10e9 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -26,31 +26,54 @@ jobs: name: '${{ matrix.os }}' strategy: + fail-fast: true matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v3 - - name: 'Determine number of cores to build on' + - name: 'Determine number of cores to build on (Linux)' + if: runner.os == 'Linux' run: echo NPROC=$(nproc) >> $GITHUB_ENV + - name: 'Determine number of cores to build on (macOS)' + if: runner.os == 'macOS' + run: echo NPROC=$(sysctl -n hw.logicalcpu) >> $GITHUB_ENV + # Setting MAKE interferes with Makefile{,.in,.am} using $(MAKE) internally - name: 'Prepare concurrent make' run: if test "x$NPROC" = x; then echo ci_MAKE="make" >> $GITHUB_ENV; echo "NPROC must be set"; exit 1; else echo ci_MAKE="make -j${NPROC} -l${NPROC}" >> $GITHUB_ENV; fi - - name: 'Update software database' + - name: 'Update software database (Linux)' + if: runner.os == 'Linux' run: sudo apt-get update - - name: 'Work around apt-get 3rd party repo libgd-dev dependency' + - name: 'Update software database (macOS)' + if: runner.os == 'macOS' + run: brew update + + - name: 'Work around apt-get 3rd party repo libgd-dev dependency (Linux)' + if: runner.os == 'Linux' run: sudo apt-get remove nginx libgd3 - - name: 'Install build requirements' + - name: 'Install build requirements (Linux)' + if: runner.os == 'Linux' run: sudo apt-get install -y autopoint gettext libusb-1.0-0-dev libcurl4-openssl-dev libgd-dev - - name: 'OS specific build flags' + - name: 'Install build requirements (macOS)' + if: runner.os == 'macOS' + run: brew install automake gd gettext libexif libtool libusb + + - name: 'OS specific build flags (Linux)' + if: runner.os == 'Linux' run: echo OS_SPECIFIC_CPPFLAGS="" >> $GITHUB_ENV + # FIXME: Fix source to build without the -D_DARWIN_C_SOURCE here + - name: 'OS specific build flags (macOS)' + if: runner.os == 'macOS' + run: echo OS_SPECIFIC_CPPFLAGS="-D_DARWIN_C_SOURCE -I$(brew --prefix)/include" >> $GITHUB_ENV + - name: 'autoreconf' run: autoreconf -i -f @@ -63,7 +86,9 @@ jobs: - name: 'make check' run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" check - - name: 'make distcheck' + # FIXME: fix make distcheck to run on macOS + - name: 'make distcheck (non-macOS)' + if: runner.os != 'macOS' run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" DISTCHECK_CONFIGURE_FLAGS="${COMMON_CONFIGURE_FLAGS}" distcheck - name: 'make install' @@ -72,6 +97,14 @@ jobs: - name: 'make installcheck' run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" installcheck + - name: 'find ldd replacement (MacOS)' + if: runner.os == 'macOS' + run: echo 'LDD=otool -L' >> $GITHUB_ENV + + - name: 'find ldd replacement (Linux)' + if: runner.os == 'Linux' + run: echo 'LDD=ldd' >> $GITHUB_ENV + - name: 'Build and run example libgphoto2 frontend (ambs-lgp2-frontend)' run: | set -x @@ -83,8 +116,8 @@ jobs: autoreconf -vis ./configure --prefix="$PWD/__pref" make - ldd ambs-lgp2-frontend + ${LDD-false} ambs-lgp2-frontend ./ambs-lgp2-frontend make install - ldd __pref/bin/ambs-lgp2-frontend + ${LDD-false} __pref/bin/ambs-lgp2-frontend __pref/bin/ambs-lgp2-frontend -- cgit v1.2.1