Add BUILD_SHARED_LIBS for shared or static library build (#639) #316
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build for macOS | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- '.github/workflows/macos.yml' | |
- 'cmake/**' | |
- 'meos/**' | |
- 'mobilitydb/**' | |
- 'postgis/**' | |
- 'CMakeLists.txt' | |
branch_ignore: gh-pages | |
pull_request: | |
paths: | |
- '.github/workflows/macos.yml' | |
- 'cmake/**' | |
- 'meos/**' | |
- 'mobilitydb/**' | |
- 'postgis/**' | |
- 'CMakeLists.txt' | |
branch_ignore: gh-pages | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-13, macos-14 ] | |
include: | |
- os: macos-13 | |
pg_path: "/usr/local/var/postgres" | |
- os: macos-14 | |
pg_path: "/opt/homebrew/var/postgres" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get dependencies from homebrew (cache) | |
uses: tecolicom/actions-use-homebrew-tools@v1 | |
with: | |
tools: postgresql postgis proj gsl | |
- name: update brew | |
if: matrix.os == 'macos-13' | |
# Necessary to avoid issue with macOS runners. See | |
# https://github.com/actions/runner-images/issues/4020 | |
run: | | |
brew reinstall python@3.12 || brew link --overwrite python@3.12 | |
brew update | |
- name: reinstall cmake | |
# Remove once issue with hombrew cache action is fixed | |
run: | | |
brew reinstall cmake | |
- name: Configure | |
run: | | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release .. | |
- name: Build | |
run: | | |
cd build | |
make -j | |
sudo make install | |
- name: test install | |
run: | | |
mkdir ${{ matrix.pg_path }} | |
initdb -D ${{ matrix.pg_path }} | |
pg_ctl -D ${{ matrix.pg_path }} start | |
createdb ___mobdb___test___ | |
psql -d ___mobdb___test___ -c "CREATE EXTENSION mobilitydb CASCADE; SELECT postgis_full_version(); SELECT mobilitydb_full_version();" | |
- name: Test | |
run: | | |
cd build | |
make test |