summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2022-11-11 10:19:43 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2022-11-14 10:36:23 +0100
commit4dd0f3a32214568e6f20aefdfe8716ccf7071fca (patch)
treea28a807931eec4263cfdbecad30a6740d9447a3d /.github
parentb361f8f7192f632a2bf14ad5018e0633dbe578c0 (diff)
downloadlibgphoto2-4dd0f3a32214568e6f20aefdfe8716ccf7071fca.tar.gz
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.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ccpp.yml51
1 files changed, 42 insertions, 9 deletions
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