-
-
Notifications
You must be signed in to change notification settings - Fork 227
185 lines (160 loc) ยท 6.44 KB
/
macos.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
name: ๐ MacOS
on:
push:
branches:
- master
- release-**
pull_request:
release:
types: ['published']
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
jobs:
build:
strategy:
matrix:
include:
- os: macos-13
triplet: x64-osx
deployment-target: "10.15"
- os: macos-14
triplet: arm64-osx
deployment-target: "11.0"
name: build (macos)
runs-on: ${{ matrix.os }}
steps:
- name: ๐ฃ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: ๐พ Prepare variables
id: vars
run: |
./scripts/ci/env_gh.sh
BUILD_ROOT="/Users/runner"
echo "BUILD_ROOT=${BUILD_ROOT}" >> $GITHUB_ENV
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CMAKE_BUILD_DIR=${BUILD_ROOT}/builddir" >> $GITHUB_ENV
- name: โ๏ธ Setup SSH
uses: webfactory/[email protected]
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
with:
ssh-private-key: ${{ secrets.SSH_KEY_DEPLOYMENT_CERTIFICATES }}
- name: ๐ Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: ๐ Setup code signing
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
bundle install
bundle exec fastlane ios setup_signing type:development app_identifier:ch.opengis.qfield # --verbose
- name: ๐ฉ Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: ๐จ Prepare build env
run: |
brew install automake bison flex gnu-sed create-dmg autoconf-archive nasm libtool
echo $(brew --prefix bison)/bin >> $GITHUB_PATH
echo $(brew --prefix flex)/bin >> $GITHUB_PATH
echo $(brew --prefix libtool)/bin >> $GITHUB_PATH
- name: ๐ฉ Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.0
- name: ๐ญ Setup XCode
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- name: ๐ฎ ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-${{ matrix.triplet }}-qt6
max-size: 200M
- name: ๐ Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: ๐ฑ Install dependencies and generate project files
run: |
source ./scripts/version_number.sh
source ./scripts/ci/generate-version-details.sh
cmake -S "${{ github.workspace }}" \
-B "${CMAKE_BUILD_DIR}" \
-G Xcode \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D WITH_VCPKG=ON \
-D WITH_NFC=OFF \
-D WITH_SPIX=ON \
-D APP_VERSION="${APP_VERSION}" \
-D APP_VERSION_STR="${APP_VERSION_STR}" \
-D APP_PACKAGE_NAME="${APP_PACKAGE_NAME}" \
-D ENABLE_TESTS=ON \
-D NUGET_USERNAME=opengisch \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D MACOS_CODE_SIGN_IDENTITY="Apple Development" \
-D CMAKE_CXX_VISIBILITY_PRESET=hidden \
-D CMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.deployment-target }} \
-D WITH_CCACHE=ON
- name: ๐ Build
run: |
# https://www.reddit.com/r/MacOS/comments/f37ybt/osascript_cant_open_default_scripting_component/?utm_medium=android_app&utm_source=share
sudo rm -rf /Library/Audio/Plug-Ins/Components
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config ${{ env.BUILD_TYPE }}
- name: ๐งซ Test
env:
PROJ_LIB: ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/${{ matrix.triplet }}/share/proj
QFIELD_SYSTEM_SHARED_DATA_PATH: ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/${{ matrix.triplet }}/share
run: |
pip install -r "${{ github.workspace }}/test/spix/requirements.txt"
cd "${{ env.CMAKE_BUILD_DIR }}"
ctest --output-on-failure -R smoke -C ${{ env.BUILD_TYPE }}
- name: ๐ฆ Package
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
echo "Killing XProtect..."; sudo pkill -9 XProtect >/dev/null || true; # see https://github.com/actions/runner-images/issues/7522
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target bundle --config ${{ env.BUILD_TYPE }}
echo "ARTIFACT_PATHNAME=${{ env.CMAKE_BUILD_DIR }}/QField-Installer.dmg" >> $GITHUB_ENV
echo "ARTIFACT_NAME=qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-${{ matrix.triplet }}.dmg" >> $GITHUB_ENV
- name: ๐ฆ Upload package
uses: actions/upload-artifact@v4
with:
name: "QField-dev-${{ matrix.triplet }}-experimental-qt6"
path: ${{ env.CMAKE_BUILD_DIR }}/QField-Installer.dmg
- name: ๐ Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: "test-report-${{ matrix.triplet }}-${{ env.BUILD_TYPE }}"
path: "${{ env.CMAKE_BUILD_DIR }}/report"
- name: ๐ Upload release asset
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && env.ARTIFACT_NAME != null
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARTIFACT_PATHNAME }}
asset_name: ${{ env.ARTIFACT_NAME }}
overwrite: true
- name: ๐ Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs-${{ matrix.triplet }}
path: |
${{ env.CMAKE_BUILD_DIR }}/**/*.log
- name: ๐ฎ Upload debug symbols
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
# if: release or labeled PR
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG_SLUG: opengisch
SENTRY_PROJECT_SLUG: qfield
run: |
bundle exec fastlane run sentry_debug_files_upload path:${{ env.CMAKE_BUILD_DIR }}