-
Notifications
You must be signed in to change notification settings - Fork 77
406 lines (400 loc) · 15.1 KB
/
debug.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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
name: Debug build
on:
push:
branches:
- dev
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/debug.yml'
jobs:
check:
name: Check Access
runs-on: ubuntu-latest
steps:
- name: "Check access"
uses: "lannonbr/[email protected]"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ffmpeg:
name: Native Build (FFmpeg)
runs-on: ubuntu-latest
needs: check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
sed -i 's/\/\///g' settings.gradle
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
git submodule status TMessagesProj/jni/libvpx > libvpx_status
- name: FFmpeg Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/jni/ffmpeg/build
TMessagesProj/jni/libvpx/build
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }}
- name: Set up JDK 17
uses: actions/setup-java@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v3
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install yasm -y
./run init libs libvpx
./run init libs ffmpeg
boringssl:
name: Native Build (BoringSSL)
runs-on: ubuntu-latest
needs: check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
sed -i 's/\/\///g' settings.gradle
git submodule status TMessagesProj/jni/boringssl > boringssl_status
- name: BoringSSL Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
- name: Set up JDK 17
uses: actions/setup-java@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v3
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run init action boringssl
./run init libs boringssl
native:
name: Native Build (Telegram)
runs-on: ubuntu-latest
needs:
- ffmpeg
- boringssl
strategy:
matrix:
flavor:
- armeabi-v7a
- arm64-v8a
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
sed -i 's/\/\///g' settings.gradle
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
git submodule status TMessagesProj/jni/libvpx > libvpx_status
git submodule status TMessagesProj/jni/boringssl > boringssl_status
- name: Native Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }}
- name: Checkout Library
if: steps.cache.outputs.cache-hit != 'true'
run: |
git submodule update --init 'TMessagesProj/jni/*'
- name: FFmpeg Cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/ffmpeg/build
TMessagesProj/jni/libvpx/build
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }}
- name: BoringSSL Cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
- name: Set up JDK 17
uses: actions/setup-java@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v3
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
- name: Fix BoringSSL
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd TMessagesProj/jni
./patch_boringssl.sh
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
export NATIVE_TARGET="${{ matrix.flavor }}"
./run libs native
build:
name: Gradle Build
runs-on: ubuntu-latest
needs:
- native
strategy:
matrix:
flavor:
# - FullRelease
- MiniRelease
- MiniReleaseNoGcm
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v3
- name: Install NDK
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
- name: Fetch Status
run: |
sed -i 's/\/\///g' settings.gradle
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
git submodule status TMessagesProj/jni/boringssl > boringssl_status
- name: Native Cache (armeabi-v7a)
uses: actions/cache@v2
with:
path: |
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a
- name: Native Cache (arm64-v8a)
uses: actions/cache@v2
with:
path: |
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a
- name: Configure Gradle
run: |
sed -i -e "s/16384/6144/g" gradle.properties
echo "sdk.dir=${ANDROID_HOME}" >> local.properties
- name: Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle') }}
- name: Debug Build
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
export DEBUG_BUILD=true
./gradlew TMessagesProj:assemble${{ matrix.flavor }}
APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')
APK=$(dirname $APK)
echo "APK=$APK" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.flavor }}
path: ${{ env.APK }}
# build-nogcm:
# name: Gradle Build (nogcm)
# runs-on: ubuntu-latest
# needs:
# - native
# - v2ray
# - shadowsocks
# - shadowsocksr
# - build
# strategy:
# matrix:
# flavor:
# - FullReleaseNoGcm
# - MiniReleaseNoGcm
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Android SDK Tools
# uses: android-actions/setup-android@v2
# - name: Install NDK
# run: |
# echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
# echo "sdk.dir=${ANDROID_HOME}" > local.properties
# echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
# - name: Fetch Status
# run: |
# sed -i 's/\/\///g' settings.gradle
# git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
# git submodule status TMessagesProj/jni/boringssl > boringssl_status
# git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status
# git submodule status 'ssr-libev/*' > shadowsocksr_status
# git submodule status v2ray > v2ray_status
# - name: Native Cache (armeabi-v7a)
# uses: actions/cache@v2
# with:
# path: |
# TMessagesProj/src/main/libs
# key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a
# - name: Native Cache (arm64-v8a)
# uses: actions/cache@v2
# with:
# path: |
# TMessagesProj/src/main/libs
# key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a
# - name: V2ray Cache
# uses: actions/cache@v2
# with:
# path: |
# TMessagesProj/libs/libv2ray.aar
# key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }}
# - name: Shadowsocks Cache
# uses: actions/cache@v2
# with:
# path: |
# TMessagesProj/libs/ss-rust-release.aar
# key: ${{ hashFiles('shadowsocks_status') }}
# - name: ShadowsocksR Cache
# uses: actions/cache@v2
# with:
# path: |
# TMessagesProj/libs/ssr-libev-release.aar
# key: ${{ hashFiles('shadowsocksr_status') }}
# - name: Configure Gradle
# run: |
# sed -i -e "s/16384/6144/g" gradle.properties
# echo "sdk.dir=${ANDROID_HOME}" >> local.properties
# - name: Gradle cache
# uses: actions/cache@v2
# with:
# path: ~/.gradle
# key: gradle-${{ hashFiles('**/*.gradle') }}
# - name: Debug Build
# run: |
# export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
# export DEBUG_BUILD=true
# ./gradlew TMessagesProj:assemble${{ matrix.flavor }}
#
# APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')
# APK=$(dirname $APK)
# echo "APK=$APK" >> $GITHUB_ENV
# - uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.flavor }}
# path: ${{ env.APK }}
upload:
name: Upload debug
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'bump version') }}
needs:
- build
# - build-nogcm
- telegram-bot-api
steps:
- name: Donwload Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Download Telegram Bot API Binary
uses: actions/download-artifact@master
with:
name: telegram-bot-api-binary
path: .
- name: Send to Telegram
run: |
chmod +x telegram-bot-api-binary
function start() {
./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null &
}
start
curl http://127.0.0.1:8081/ || start
curl http://127.0.0.1:8081/ || start
curl http://127.0.0.1:8081/ || start
# send release via telegram bot api
export mini64=$(find artifacts -name "*arm64-v8a.apk")
export mini32=$(find artifacts -name "*armeabi-v7a.apk")
# export full64=$(find artifacts -name "*full-arm64-v8a.apk")
# export full32=$(find artifacts -name "*full-armeabi-v7a.apk")
export mini64nogcm=$(find artifacts -name "*arm64-v8aNoGcm.apk")
export mini32nogcm=$(find artifacts -name "*armeabi-v7aNoGcm.apk")
# export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk")
# export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk")
echo $mini64
echo $mini32
# echo $full64
# echo $full32
echo $mini64nogcm
echo $mini32nogcm
# echo $full64nogcm
# echo $full32nogcm
curl --http0.9 http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup --form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} --form apk1=@"${mini64}" --form apk2=@"${mini32}" --form apk3=@"${mini64nogcm}" --form apk4=@"${mini32nogcm}" --form-string media="[{\"type\": \"document\",\"media\": \"attach://apk1\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk2\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk3\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk4\",\"caption\": \"Test version, ${{ github.event.head_commit.message }}\",\"parse_mode\": \"Markdown\"}]" --verbose >/dev/null
pkill telegram-bot
telegram-bot-api:
name: Telegram Bot API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Clone Telegram Bot API
run: |
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
git status telegram-bot-api >> telegram-bot-api-status
- name: Cache Bot API Binary
id: cache-bot-api
uses: actions/cache@v2
with:
path: telegram-bot-api-binary
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }}
- name: Compile Telegram Bot API
if: steps.cache-bot-api.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
cd telegram-bot-api
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
cmake --build . --target install -j$(nproc)
cd ../..
ls -l telegram-bot-api/bin/telegram-bot-api*
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary
- name: Upload Binary
uses: actions/upload-artifact@master
with:
name: telegram-bot-api-binary
path: telegram-bot-api-binary