# GitHub Actions – macOS CI # Replaces .cirrus.yml name: "CI (macOS)" on: push: ~ pull_request: ~ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: macos: name: "macOS" runs-on: macos-latest env: PG: "18" HOMEBREW_PREFIX: "/opt/homebrew" CCACHE_DIR: "${{ github.workspace }}/.ccache" CCACHE_MAXSIZE: "1G" steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false fetch-depth: 50 - name: Check changed surface id: changed-surface run: | set +e python3 ci/ci_need_suite.py github-ci gate_status=$? set -e if test "${gate_status}" = 78; then echo "skip=true" >> "${GITHUB_OUTPUT}" exit 0 fi exit "${gate_status}" - name: Cache ccache if: steps.changed-surface.outputs.skip != 'true' uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ${{ env.CCACHE_DIR }} key: macos-ccache-${{ github.sha }} restore-keys: | macos-ccache- - name: Install dependencies if: steps.changed-surface.outputs.skip != 'true' run: | brew update brew install \ autoconf automake libtool pkg-config \ ccache \ gdal geos icu4c json-c libpq libxml2 \ proj protobuf-c sfcgal cunit \ docbook docbook-xsl \ postgresql@${PG} gettext brew link --force gettext ccache --max-size="${CCACHE_MAXSIZE}" sudo ln -sfn "${HOMEBREW_PREFIX}/opt/postgresql@${PG}/bin/postgres" /usr/local/bin/postgres - name: Build and test if: steps.changed-surface.outputs.skip != 'true' env: CC: "ccache clang" CXX: "ccache clang++" run: | export PATH="${HOMEBREW_PREFIX}/opt/postgresql@${PG}/bin:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:${HOMEBREW_PREFIX}/opt/ccache/libexec:${PATH}" export PGCONFIG="${HOMEBREW_PREFIX}/opt/postgresql@${PG}/bin/pg_config" export CFLAGS="-I${HOMEBREW_PREFIX}/opt/gettext/include -I${HOMEBREW_PREFIX}/opt/postgresql@${PG}/include -I${HOMEBREW_PREFIX}/include -Wno-nullability-completeness" export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/gettext/lib -L${HOMEBREW_PREFIX}/opt/postgresql@${PG}/lib" export CXXFLAGS="-std=c++17" show_regression_diffs() { local tmpdir="${PGIS_REG_TMPDIR:-/tmp/pgis_reg}" local found=0 for f in "${tmpdir}"/*_diff; do [ -f "${f}" ] || continue if [ "${found}" -eq 0 ]; then echo "---- BEGIN REGRESSION DIFFS (${tmpdir}) ----" fi found=1 echo "---- ${f} ----" cat "${f}" done if [ "${found}" -eq 0 ]; then echo "No regression diff files found in ${tmpdir}" else echo "---- END REGRESSION DIFFS ----" fi } ./autogen.sh ./configure \ --without-gui \ --without-interrupt-tests \ --with-topology \ --without-raster \ --with-sfcgal \ --with-protobuf \ --with-pgconfig="${PGCONFIG}" brew services start "postgresql@${PG}" make -j$(sysctl -n hw.logicalcpu) || { brew services stop "postgresql@${PG}"; exit 1; } sudo make install || { brew services stop "postgresql@${PG}"; exit 1; } make -j$(sysctl -n hw.logicalcpu) check RUNTESTFLAGS="-v --extension --dumprestore" || { show_regression_diffs brew services stop "postgresql@${PG}" exit 1 } brew services stop "postgresql@${PG}"