auto sipify 🍺 #45706
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: 🍏 Mac OS build | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
- release-** | |
- queued_ltr_backports | |
paths: | |
pull_request: | |
branches: | |
- master | |
- release-** | |
- queued_ltr_backports | |
paths: | |
env: | |
QT_VERSION: 5.15.2 | |
QGIS_DEPS_VERSION: 0.9 | |
QGIS_DEPS_PATCH_VERSION: 0 | |
CCACHE_DIR: /Users/runner/work/ccache | |
BUILD_DIR: /Users/runner/work/QGIS/build-QGIS | |
# apparently we cannot cache /opt directory as it fails to restore | |
# so we copy the deps in the home directory | |
DEPS_CACHE_DIR: /Users/runner/work/deps-cache | |
jobs: | |
mac_os_build: | |
if: github.repository == 'qgis/QGIS' | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restore build cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: build-ccache-mac-${{ github.event.pull_request.base.ref || github.ref_name }} | |
restore-keys: | | |
build-ccache-mac-master | |
- name: Cache Qt | |
id: cache-qt | |
uses: actions/[email protected] | |
with: | |
path: ${{ env.DEPS_CACHE_DIR }}/Qt/${{ env.QT_VERSION }} | |
key: mac-qt-${{ env.QT_VERSION }} | |
- name: Restore Qt | |
if: steps.cache-qt.outputs.cache-hit == 'true' | |
run: | | |
sudo mkdir -p /opt | |
sudo mkdir -p /opt/Qt | |
sudo cp -r ${DEPS_CACHE_DIR}/Qt/${QT_VERSION} /opt/Qt/${QT_VERSION} | |
- name: Download Qt | |
if: steps.cache-qt.outputs.cache-hit != 'true' | |
run: | | |
wget https://qgis.org/downloads/macos/deps/qt-${QT_VERSION}.tar.gz | |
mkdir -p ${DEPS_CACHE_DIR} | |
mkdir -p ${DEPS_CACHE_DIR}/Qt | |
# QGIS-deps caching | |
- name: Cache qgis-deps | |
id: cache-deps | |
uses: actions/[email protected] | |
with: | |
path: ${{ env.DEPS_CACHE_DIR }}/QGIS/qgis-deps-${{ env.QGIS_DEPS_VERSION }}.${{ env.QGIS_DEPS_PATCH_VERSION }} | |
key: mac-qgis-deps-${{ env.QGIS_DEPS_VERSION }}.${{ env.QGIS_DEPS_PATCH_VERSION }} | |
- name: Restore qgis-deps | |
if: steps.cache-deps.outputs.cache-hit == 'true' | |
run: | | |
sudo mkdir -p /opt | |
sudo mkdir -p /opt/QGIS | |
sudo cp -r ${DEPS_CACHE_DIR}/QGIS/qgis-deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION} /opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION} | |
- name: Download qgis-deps | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
wget https://qgis.org/downloads/macos/deps/qgis-deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION}.tar.gz | |
mkdir -p ${DEPS_CACHE_DIR} | |
mkdir -p ${DEPS_CACHE_DIR}/QGIS | |
- name: Install Qt and deps | |
env: | |
QT_ALREADY_CACHED: ${{ steps.cache-qt.outputs.cache-hit }} | |
QGIS_DEPS_ALREADY_CACHED: ${{ steps.cache-deps.outputs.cache-hit }} | |
run: | | |
wget https://qgis.org/downloads/macos/deps/install_qgis_deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION}.bash | |
chmod +x ./install_qgis_deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION}.bash | |
echo ::group::Install deps | |
sudo ./install_qgis_deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION}.bash | |
echo ::endgroup:: | |
[[ ${QT_ALREADY_CACHED} != "true" ]] && cp -r /opt/Qt/${QT_VERSION} ${DEPS_CACHE_DIR}/Qt/${QT_VERSION} || true | |
[[ ${QGIS_DEPS_ALREADY_CACHED} != "true" ]] && cp -r /opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION} ${DEPS_CACHE_DIR}/QGIS/qgis-deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION} || true | |
- name: Install ccache | |
run: | | |
mkdir -p ${CCACHE_DIR} | |
brew install ccache | |
ccache --set-config=max_size=2.0G | |
ccache -s | |
- name: Run cmake | |
run: | | |
mkdir -p ${BUILD_DIR} | |
cd ${BUILD_DIR} | |
PATH=/opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}/stage/bin:$PATH \ | |
cmake -DQGIS_MAC_DEPS_DIR=/opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}/stage \ | |
-DCMAKE_PREFIX_PATH=/opt/Qt/${QT_VERSION}/clang_64 \ | |
-DWITH_BINDINGS=TRUE \ | |
-DWITH_3D=TRUE \ | |
-DWITH_DRACO=FALSE \ | |
-DWITH_PDAL=TRUE \ | |
-DWITH_EPT=TRUE \ | |
../QGIS | |
- name: Build QGIS | |
run: | | |
cd ${BUILD_DIR} | |
make -j $(sysctl -n hw.ncpu) | |
- name: Save build cache for push only | |
uses: actions/cache/save@v4 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: build-ccache-mac-${{ github.ref_name }}-${{ github.run_id }} |