-
Notifications
You must be signed in to change notification settings - Fork 14
190 lines (159 loc) · 6 KB
/
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
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
name: Build
on:
workflow_call:
inputs:
platform:
required: true
type: string
developer-dir:
required: true
type: string
env:
DEVELOPER_DIR: ${{ inputs.developer-dir }}
PLATFORM: ${{ inputs.platform }}
jobs:
build-openssl:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Patch Build script
run: |
cd td
git apply ../builder/tdlib-patches/build-openssl.patch
- name: Cache Openssl
id: cache-openssl
uses: actions/cache@v4
with:
path: td/example/ios/third_party/openssl/${{ env.PLATFORM }}
key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }}
- name: Install deps
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: brew install gperf cmake coreutils
- name: Build Openssl
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: |
cd td/example/ios
./build-openssl.sh $PLATFORM
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: openssl-${{ env.PLATFORM }}
path: td/example/ios/third_party/openssl/${{ env.PLATFORM }}
if-no-files-found: error
build-tdlib:
runs-on: macos-14
needs: [build-openssl]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Patch Build
run: |
cp builder/tdlib-patches/build.sh td/example/ios
- name: Cache tdlib
id: cache-tdlib
uses: actions/cache@v4
with:
path: td/example/ios/build/install-${{ env.PLATFORM }}
key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }}
- name: Restore ccache cache
if: steps.cache-tdlib.outputs.cache-hit != 'true'
id: cache-ccache
uses: actions/cache@v4
with:
path: ~/Library/Caches/ccache
key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-
tdlib-ccache-v1-${{ env.PLATFORM }}-
- name: Install deps
if: steps.cache-tdlib.outputs.cache-hit != 'true'
run: brew install gperf cmake coreutils ccache
# - name: Upgrade cmake # we need 3.28.2 to escape "SDK settings were ignored as 'SDKSettings.json' could not be parsed" on Xcode 14.2 and tvOS
# if: env.PLATFORM == 'tvOS'
# run: brew update && brew upgrade cmake
- name: Download Artifacts
if: steps.cache-tdlib.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: openssl-${{ env.PLATFORM }}
path: td/example/ios/third_party/openssl/${{ env.PLATFORM }}
# Sources are pregenerated in build phase for macOS
- name: Pregenerate Sources
if: steps.cache-tdlib.outputs.cache-hit != 'true' && env.PLATFORM != 'macOS'
run: |
cd td
mkdir native-build
cd native-build
cmake ..
cmake --build . --target prepare_cross_compiling
- name: Build TDLib
if: steps.cache-tdlib.outputs.cache-hit != 'true'
run: |
cd td/example/ios
if [[ $PLATFORM == "visionOS"* ]]; then
# NOTE: for visionOS, no (-mxros-version-min) flag exists yet, so we omit the flag completely
./build.sh $PLATFORM ""
else
./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})"
fi
- name: Show ccache stats
if: steps.cache-tdlib.outputs.cache-hit != 'true'
run: ccache --show-stats --verbose
- name: Upload ${{ env.PLATFORM }} install artifacts
uses: actions/upload-artifact@v4
with:
name: tdlib-install-${{ env.PLATFORM }}
path: td/example/ios/build/install-${{ env.PLATFORM }}
if-no-files-found: error
build-framework:
runs-on: macos-14
needs: [build-tdlib]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download Openssl
uses: actions/download-artifact@v4
with:
name: openssl-${{ env.PLATFORM }}
path: td/example/ios/third_party/openssl/${{ env.PLATFORM }}
- name: Download TDLib ${{ env.PLATFORM }} install
uses: actions/download-artifact@v4
with:
name: tdlib-install-${{ env.PLATFORM }}
path: td/example/ios/build/install-${{ env.PLATFORM }}
- name: Patch headers
working-directory: ./builder
run: ./patch-headers.sh
- name: Generate project
run: |
curl https://mise.run | sh
export PATH="$HOME/.local/bin:$PATH"
mise install # Installs the tools in .mise.toml
eval "$(mise activate bash --shims)" # Adds the activated tools to $PATH
cd builder
TUIST_PLATFORM=$PLATFORM tuist generate
# https://github.com/actions/runner-images/issues/10692
- uses: ./.github/actions/install-visionos-runtime
if: ${{ env.PLATFORM == 'visionOS' || env.PLATFORM == 'visionOS-simulator' }}
with:
developer_dir: ${{ env.DEVELOPER_DIR }}
- name: Build .framework
working-directory: ./builder
run: ./build-framework.sh $PLATFORM
- name: Compress xcarchive
run: |
cd builder/build
zip --symlinks -r ${{ env.PLATFORM }}.xcarchive.zip ${{ env.PLATFORM }}.xcarchive
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: xcarchive-${{ env.PLATFORM }}
path: ./builder/build/${{ env.PLATFORM }}.xcarchive.zip
if-no-files-found: error