-
Notifications
You must be signed in to change notification settings - Fork 2.2k
275 lines (274 loc) · 10.6 KB
/
master-push.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: Prepare Release
on:
workflow_dispatch:
push:
branches:
- "master"
- "release/**"
env:
XCODE_VERSION: "['15.1', '15.2', '15.3', '15.4']"
PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']"
DOC_VERSION: '15.4'
RELEASE_VERSION: '15.4'
TEST_VERSION: '15.4'
jobs:
prepare:
runs-on: ubuntu-latest
name: Prepare outputs
outputs:
XCODE_VERSIONS_MATRIX: ${{ env.XCODE_VERSION }}
PLATFORM_MATRIX: ${{ env.PLATFORM }}
VERSION: ${{ steps.get-version.outputs.VERSION }}
steps:
- name: Compute outputs
run: |
echo "XCODE_VERSIONS_MATRIX=${{ env.XCODE_VERSION }}" >> $GITHUB_OUTPUT
echo "PLATFORM_MATRIX=${{ env.PLATFORM }}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Read SDK version
id: get-version
run: |
version="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${GITHUB_WORKSPACE}/dependencies.list")"
echo "VERSION=$version" >> $GITHUB_OUTPUT
build-docs:
runs-on: macos-14
name: Package docs
needs: prepare
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.DOC_VERSION }}.app
- name: Prepare docs for packaging
run: bundle exec sh -x build.sh release-package-docs
- name: Upload docs to artifacts library
uses: actions/upload-artifact@v4
with:
name: realm-docs
path: docs/realm-docs.zip
build-examples:
runs-on: macos-14
name: Package examples
needs: prepare
steps:
- uses: actions/checkout@v4
- name: Prepare examples for packaging
run: sh -x build.sh release-package-examples
- name: Upload examples to artifacts library
uses: actions/upload-artifact@v4
with:
name: realm-examples
path: realm-examples.zip
build-product: # Creates framework for each platform, xcode version, target and configuration
runs-on: macos-14
name: Package framework
needs: prepare
strategy:
max-parallel: 20 # Blocks of 20, therefore if any of the build fails, we don't get a lot of XCode Clouds builds hanging, which are expensive.
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }}
xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}
configuration: [swift, static]
exclude:
- platform: osx
configuration: static
- platform: tvos
configuration: static
- platform: watchos
configuration: static
- platform: visionos
configuration: static
- platform: catalyst
configuration: static
- platform: visionos
xcode-version: 15.1
steps:
- uses: actions/checkout@v4
- name: Build ${{ matrix.platform }} with Xcode ${{ matrix.xcode-version }}
run: DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer sh build.sh ${{ matrix.platform }}-${{matrix.configuration}}
- name: Upload framework
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.configuration }}
path: build
compression-level: 1
package-xcframework-platform: # Creates xcframework for each platform and xcode version
runs-on: macos-14
name: Package xcframework for platform
needs: [build-product, prepare]
strategy:
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }}
xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}
exclude:
- platform: visionos
xcode-version: 15.1
steps:
- uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app
- name: Install the Apple certificate and provisioning profile
env:
DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DEVELOPMENT_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
sh -x build.sh install-apple-certificates
- name: Restore frameworks
uses: actions/download-artifact@v4
with:
pattern: build-${{ matrix.platform }}*-${{ matrix.xcode-version }}-*
- name: Create xcframework
env:
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}
run: |
sh -x build.sh release-create-xcframework-${{ matrix.xcode-version }} ${{ matrix.platform }}
- name: Upload xcframework
uses: actions/upload-artifact@v4
with:
name: realm-${{ matrix.platform }}-${{ matrix.xcode-version }}
path: realm-${{ matrix.platform }}-${{ matrix.xcode-version }}.zip
package-release: # Creates xcframework for each platform and xcode version
runs-on: macos-14
name: Package release file
needs: [package-xcframework-platform, prepare]
steps:
- uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app
- name: Install the Apple certificate and provisioning profile
env:
DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DEVELOPMENT_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
sh -x build.sh install-apple-certificates
- name: Restore packages xcframeworks
uses: actions/download-artifact@v4
with:
pattern: realm-*
- name: Create release
env:
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}
run: |
sh -x build.sh release-package
- name: Upload release artifactss
uses: actions/upload-artifact@v4
with:
name: release-package
path: pkg/*.zip
- name: Upload release for testing
uses: actions/upload-artifact@v4
with:
name: realm-swift-${{ needs.prepare.outputs.VERSION }}
path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip
test-package-examples:
runs-on: macos-14
name: Test examples
needs: [package-release, prepare]
steps:
- uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app
- name: Restore release
uses: actions/download-artifact@v4
with:
name: realm-swift-${{ needs.prepare.outputs.VERSION }}
- name: Test examples
run: sh -x build.sh release-test-examples
test-ios-static:
runs-on: macos-14
name: Run tests on iOS with configuration Static
needs: package-release
steps:
- uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app
- name: Test ios static
run: sh -x build.sh test-ios-static
test-osx-static:
runs-on: macos-14
name: Run tests on macOS
needs: package-release
steps:
- uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app
- name: Test osx static
run: |
export REALM_DISABLE_METADATA_ENCRYPTION=1
sh -x build.sh test-osx
test-installation:
runs-on: macos-14
name: Run installation test
needs: [package-release, prepare]
strategy:
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }}
installation: [cocoapods, spm, carthage, xcframework]
linkage: [dynamic, static]
exclude:
- platform: visionos
- platform: catalyst
installation: carthage
- installation: carthage
linkage: static
- installation: xcframework
linkage: static
include:
- platform: ios
installation: xcframework
linkage: static
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app
- name: Restore release
uses: actions/download-artifact@v4
if: ${{ matrix.installation == 'xcframework' }}
with:
name: realm-${{ matrix.platform }}-${{ env.TEST_VERSION }}
- name: Unzip package release
if: ${{ matrix.installation == 'xcframework' }}
run: |
mkdir -p build
unzip realm-${{ matrix.platform }}-${{ env.TEST_VERSION }}.zip -d build
- name: Run installation test
run: |
echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT
cd examples/installation
bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }}
test-installation-xcframework:
runs-on: macos-14
name: Run installation test for xcframework
needs: [package-release, prepare]
env:
PLATFORM: 'osx'
strategy:
matrix:
xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode-version }}.app
- name: Restore release
uses: actions/download-artifact@v4
with:
name: realm-${{ env.PLATFORM }}-${{ matrix.xcode-version }}
- name: Unzip package release
run: |
mkdir -p build
unzip realm-${{ env.PLATFORM }}-${{ matrix.xcode-version }}.zip -d build
- name: Run installation test
run: |
echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT
cd examples/installation
bundle exec ./build.rb osx xcframework dynamic