2020-04-05 10:51:00 +02:00
name : Mac OS build
2020-08-27 07:23:40 +02:00
on :
push :
branches :
- master
- release-**
paths :
- 'src/**'
2021-02-08 15:25:39 +01:00
- 'external/**'
2021-02-08 21:51:18 +01:00
- 'python/**'
2020-08-27 07:23:40 +02:00
- 'tests/**'
- 'mac/**'
2021-02-09 08:54:00 +01:00
- '.github/workflows/macos-build.yml'
2021-02-08 15:25:39 +01:00
- '.ci/**'
2020-08-27 07:23:40 +02:00
- 'CMakeLists.txt'
pull_request :
branches :
- master
- release-**
paths :
- 'src/**'
2021-02-08 15:25:39 +01:00
- 'external/**'
2021-02-08 21:51:18 +01:00
- 'python/**'
2020-08-27 07:23:40 +02:00
- 'tests/**'
- 'mac/**'
2021-02-09 08:54:00 +01:00
- '.github/workflows/macos-build.yml'
2021-02-08 15:25:39 +01:00
- '.ci/**'
2020-08-27 07:23:40 +02:00
- 'CMakeLists.txt'
2020-04-05 10:51:00 +02:00
env :
2020-09-09 08:21:38 +02:00
QT_VERSION : 5.14 .2
2020-11-10 13:00:17 +01:00
QGIS_DEPS_VERSION : 0.6 .0
2021-02-08 15:25:39 +01:00
CCACHE_DIR : /Users/runner/work/ccache
BUILD_DIR : /Users/runner/work/QGIS/build-QGIS
2021-02-09 14:21:00 +01:00
# 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
2020-04-05 10:51:00 +02:00
jobs :
mac_os_build :
if : github.repository == 'qgis/QGIS'
runs-on : macos-latest
steps :
- uses : actions/checkout@v2
2021-02-08 15:25:39 +01:00
- name : Prepare build cache for pull request
uses : pat-s/always-upload-cache@v2.1.3
if : github.event_name == 'pull_request'
with :
2021-02-09 08:35:31 +01:00
path : ${{ env.CCACHE_DIR }}
2021-02-09 15:46:54 +01:00
key : build-mac-ccache-${{ github.repository_owner }}-${{ github.head_ref }}-${{ github.sha }}
2021-02-08 15:25:39 +01:00
# 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 : |
2021-02-09 15:46:54 +01:00
build-mac-ccache-${{ github.repository_owner }}-${{ github.head_ref }}-
2021-02-08 15:25:39 +01:00
build-mac-ccache-${{ 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
uses : pat-s/always-upload-cache@v2.1.3
if : github.event_name != 'pull_request'
with :
2021-02-09 08:35:31 +01:00
path : ${{ env.CCACHE_DIR }}
2021-02-08 15:25:39 +01:00
# 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-
2021-02-09 14:21:00 +01:00
# Qt caching
2021-02-08 15:25:39 +01:00
- name : Cache Qt
id : cache-qt
uses : pat-s/always-upload-cache@v2.1.3
with :
2021-02-09 14:21:00 +01:00
path : ${{ env.DEPS_CACHE_DIR }}/Qt/${{ env.QT_VERSION }}
key : mac-qt-v4-${{ 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}
2021-02-08 15:25:39 +01:00
- name : Download Qt
if : steps.cache-qt.outputs.cache-hit != 'true'
2021-02-09 14:21:00 +01:00
run : |
wget https://qgis.org/downloads/macos/deps/qt-${QT_VERSION}.tar.gz
mkdir -p ${DEPS_CACHE_DIR}
mkdir -p ${DEPS_CACHE_DIR}/Qt
2020-04-05 10:51:00 +02:00
2021-02-09 14:21:00 +01:00
# QGIS-deps caching
2021-02-08 15:25:39 +01:00
- name : Cache qgis-deps
id : cache-deps
uses : pat-s/always-upload-cache@v2.1.3
with :
2021-02-09 14:21:00 +01:00
path : ${{ env.DEPS_CACHE_DIR }}/QGIS/qgis-deps-${{ env.QGIS_DEPS_VERSION }}
key : mac-qgis-deps-v4-${{ env.QGIS_DEPS_VERSION }}
2021-02-08 15:25:39 +01:00
2021-02-09 14:21:00 +01:00
- 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} /opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}
- name : Download qgis-deps
2021-02-08 15:25:39 +01:00
if : steps.cache-deps.outputs.cache-hit != 'true'
2021-02-09 14:21:00 +01:00
run : |
wget https://qgis.org/downloads/macos/deps/qgis-deps-${QGIS_DEPS_VERSION}.tar.gz
mkdir -p ${DEPS_CACHE_DIR}
mkdir -p ${DEPS_CACHE_DIR}/QGIS
2021-02-08 15:25:39 +01:00
- name : Install Qt and deps
2021-02-09 14:21:00 +01:00
env :
QT_ALREADY_CACHED : ${{ steps.cache-qt.outputs.cache-hit }}
QGIS_DEPS_ALREADY_CACHED : ${{ steps.cache-deps.outputs.cache-hit }}
2020-04-05 10:51:00 +02:00
run : |
2021-02-08 15:25:39 +01:00
wget https://qgis.org/downloads/macos/deps/install_qgis_deps-${QGIS_DEPS_VERSION}.bash
2020-04-05 10:51:00 +02:00
chmod +x ./install_qgis_deps-${QGIS_DEPS_VERSION}.bash
2021-02-09 14:21:00 +01:00
echo ::group::Install deps
2020-04-05 10:51:00 +02:00
sudo ./install_qgis_deps-${QGIS_DEPS_VERSION}.bash
2021-02-09 14:21:00 +01:00
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} || true
2020-04-05 10:51:00 +02:00
2021-02-08 15:25:39 +01:00
- name : Install ccache
run : |
mkdir -p ${CCACHE_DIR}
brew install ccache
ccache --set-config=max_size=2.0G
ccache -s
2021-02-09 14:21:00 +01:00
- name : Run cmake
2020-04-05 10:51:00 +02:00
run : |
2021-02-08 15:25:39 +01:00
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
2020-04-05 10:51:00 +02:00
2020-11-11 19:19:24 +01:00
# FIXME: PDAL disable because of #39971
2020-04-05 10:51:00 +02:00
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 \
2020-11-11 19:19:24 +01:00
-DWITH_PDAL=FALSE \
2020-11-10 13:00:17 +01:00
-DWITH_EPT=TRUE \
2021-02-08 15:25:39 +01:00
../QGIS
2020-04-05 10:51:00 +02:00
2021-02-09 14:21:00 +01:00
- name : Build QGIS
2020-04-05 10:51:00 +02:00
run : |
2021-02-08 15:25:39 +01:00
cd ${BUILD_DIR}
2020-04-05 10:51:00 +02:00
make -j $(sysctl -n hw.ncpu)