forked from OSGeo-jp/QGIS
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (128 loc) · 5.37 KB
/
macos-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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-latest
steps:
- uses: actions/checkout@v4
- name: Prepare build cache for pull request
uses: pat-s/[email protected]
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
uses: pat-s/[email protected]
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
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)