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.
This commit is contained in:
51
.github/workflows/ccpp.yml
vendored
51
.github/workflows/ccpp.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user