2021-03-22 13:15:43 +10:00
name : 🍏 Mac OS build
2023-10-09 15:19:20 +02:00
concurrency :
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress : true
2021-03-22 13:15:43 +10:00
on :
push :
branches :
- master
- release-**
2021-04-28 08:56:17 +10:00
- queued_ltr_backports
2021-03-22 13:15:43 +10:00
paths :
pull_request :
branches :
- master
- release-**
2023-02-07 09:19:37 +10:00
- queued_ltr_backports
2021-03-22 13:15:43 +10:00
paths :
env :
2021-06-17 11:22:44 +02:00
QT_VERSION : 5.15 .2
2021-09-20 10:23:17 +02:00
QGIS_DEPS_VERSION : 0.9
QGIS_DEPS_PATCH_VERSION : 0
2021-03-22 13:15:43 +10:00
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-latest
steps :
2023-10-01 19:50:29 +00:00
- uses : actions/checkout@v4
2021-03-22 13:15:43 +10:00
- name : Prepare build cache for pull request
2022-11-01 19:02:13 +00:00
uses : pat-s/always-upload-cache@v3.0.11
2021-03-22 13:15:43 +10:00
if : github.event_name == 'pull_request'
with :
path : ${{ env.CCACHE_DIR }}
key : build-mac-ccache-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
# The head_ref or source branch of the pull request in a workflow run.
# The base_ref or target branch of the pull request in a workflow run.
restore-keys : |
build-mac-ccache-${{ github.actor }}-${{ github.head_ref }}-
build-mac-ccache-refs/heads/${{ github.base_ref }}-
build-mac-ccache-refs/heads/master-
- name : Prepare build cache for branch/tag
# use a fork of actions/cache@v2 to upload cache even when the build or test failed
2022-11-01 19:02:13 +00:00
uses : pat-s/always-upload-cache@v3.0.11
2021-03-22 13:15:43 +10:00
if : github.event_name != 'pull_request'
with :
path : ${{ env.CCACHE_DIR }}
# The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>
key : build-mac-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys : |
build-mac-ccache-${{ github.ref }}-
build-mac-ccache-refs/heads/master-
# Qt caching
- name : Cache Qt
id : cache-qt
2023-10-01 19:50:25 +00:00
uses : actions/cache@v3.3.2
2021-03-22 13:15:43 +10:00
with :
path : ${{ env.DEPS_CACHE_DIR }}/Qt/${{ env.QT_VERSION }}
2021-11-20 08:39:13 +01:00
key : mac-qt-${{ env.QT_VERSION }}
2021-03-22 13:15:43 +10:00
- 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
2023-10-01 19:50:25 +00:00
uses : actions/cache@v3.3.2
2021-03-22 13:15:43 +10:00
with :
2021-09-20 10:23:17 +02:00
path : ${{ env.DEPS_CACHE_DIR }}/QGIS/qgis-deps-${{ env.QGIS_DEPS_VERSION }}.${{ env.QGIS_DEPS_PATCH_VERSION }}
2021-11-20 08:39:13 +01:00
key : mac-qgis-deps-${{ env.QGIS_DEPS_VERSION }}.${{ env.QGIS_DEPS_PATCH_VERSION }}
2021-03-22 13:15:43 +10:00
- name : Restore qgis-deps
if : steps.cache-deps.outputs.cache-hit == 'true'
run : |
sudo mkdir -p /opt
sudo mkdir -p /opt/QGIS
2021-09-20 10:23:17 +02:00
sudo cp -r ${DEPS_CACHE_DIR}/QGIS/qgis-deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION} /opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}
2021-03-22 13:15:43 +10:00
- name : Download qgis-deps
if : steps.cache-deps.outputs.cache-hit != 'true'
run : |
2021-09-20 10:23:17 +02:00
wget https://qgis.org/downloads/macos/deps/qgis-deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION}.tar.gz
2021-03-22 13:15:43 +10:00
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 : |
2021-09-20 10:23:17 +02:00
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
2021-03-22 13:15:43 +10:00
echo ::group::Install deps
2021-09-20 10:23:17 +02:00
sudo ./install_qgis_deps-${QGIS_DEPS_VERSION}.${QGIS_DEPS_PATCH_VERSION}.bash
2021-03-22 13:15:43 +10:00
echo ::endgroup: :
[ [ ${QT_ALREADY_CACHED} != "true" ]] && cp -r /opt/Qt/${QT_VERSION} ${DEPS_CACHE_DIR}/Qt/${QT_VERSION} || true
2021-09-20 10:23:17 +02:00
[ [ ${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
2021-03-22 13:15:43 +10:00
- 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 \
2023-08-06 17:01:11 +10:00
-DWITH_DRACO=FALSE \
2021-03-22 13:15:43 +10:00
-DWITH_PDAL=TRUE \
-DWITH_EPT=TRUE \
../QGIS
- name : Build QGIS
run : |
cd ${BUILD_DIR}
make -j $(sysctl -n hw.ncpu)