-
Notifications
You must be signed in to change notification settings - Fork 2
603 lines (519 loc) · 20.1 KB
/
linux.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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
name: Linux.
on: [push]
jobs:
check:
if: "!(contains(github.event.head_commit.message, '[skip ci]'))"
name: Parse parameters
runs-on: ubuntu-latest
outputs:
build: ${{ steps.parse.outputs.build }}
ref: ${{ steps.parse.outputs.ref }}
update: ${{ steps.parse.outputs.update }}
packer: ${{ steps.parse.outputs.packer }}
telegram: ${{ steps.parse.outputs.telegram }}
description: ${{ steps.parse.outputs.description }}
cache: ${{ steps.parse.outputs.cache }}
cacheonly: ${{ steps.parse.outputs.cacheonly }}
steps:
- name: Clone scripts.
uses: actions/checkout@v2
- name: Parse commit description
id: parse
uses: actions/github-script@0.9.0
with:
github-token: ${{ secrets.RELEASE_TOKEN }}
script: |
const path = require('path');
const currentBuild = "linux";
const scriptPath = path.resolve('./scripts/option_parser.js');
require(scriptPath)({github, context, currentBuild});
build:
name: Build on Ubuntu 18.04
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.build == 'true'
container:
image: ubuntu:bionic
options: --privileged --device /dev/fuse
env:
GIT: "https://github.com"
QT: "6_2_3"
CMAKE_VER: "3.21.3"
MANUAL_CACHING: "1"
AUTO_CACHING: "1"
REPO_ORG: "kotatogram"
REPO_NAME: "kotatogram-desktop"
CXX: "g++ -static-libstdc++"
steps:
- name: Disable man for further package installs.
run: |
cfgFile="/etc/dpkg/dpkg.cfg.d/no_man"
touch $cfgFile
p() {
echo "path-exclude=/usr/share/$1/*" >> $cfgFile
}
p man
p locale
p doc
- name: Apt install.
run: |
apt-get update
apt-get install software-properties-common -y && \
add-apt-repository ppa:git-core/ppa -y && \
apt-get update && \
apt-get install clang libglibmm-2.4-dev libicu-dev libssl-dev liblzma-dev zlib1g-dev \
git wget autoconf automake build-essential libtool pkg-config bison yasm unzip python3-pip \
libasound2-dev libpulse-dev libfuse2 libgtk-3-dev libgtk2.0-dev libatspi2.0-dev \
libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev libxkbcommon-dev libxkbcommon-x11-dev \
libxcb1-dev libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev \
libxcb-randr0-dev libxcb-record0-dev libxcb-render0-dev libxcb-render-util0-dev \
libxcb-res0-dev libxcb-screensaver0-dev libxcb-shape0-dev libxcb-shm0-dev \
libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-xkb-dev \
libxcb-util0-dev libx11-dev libx11-xcb-dev libxext-dev libxtst-dev libxfixes-dev \
libxrandr-dev libxrender-dev libxdamage-dev libxcomposite-dev libwayland-dev \
xutils-dev meson ninja-build subversion -y --force-yes && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update && \
apt-get install gcc-10 g++-10 -y && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 60 && \
update-alternatives --config gcc && \
add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y
- name: Clone.
uses: actions/checkout@v2
with:
repository: ${{ env.REPO_ORG }}/${{ env.REPO_NAME }}
submodules: recursive
path: ${{ env.REPO_NAME }}
ref: ${{ needs.check.outputs.ref }}
- name: Clone scripts.
if: needs.check.outputs.cacheonly == 'false'
uses: actions/checkout@v2
with:
path: buildscripts
- name: Parse current version.
if: needs.check.outputs.cacheonly == 'false'
run: ./buildscripts/scripts/parse_version.sh
- name: First set up.
run: |
wget -c -nv "$GIT/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
./linuxdeployqt-continuous-x86_64.AppImage -version
gcc --version
gcc --version > CACHE_KEY.txt
echo $MANUAL_CACHING >> CACHE_KEY.txt
if [ "$AUTO_CACHING" == "1" ]; then
thisFile=buildscripts/.github/workflows/linux.yml
echo `md5sum $thisFile | cut -c -32` >> CACHE_KEY.txt
fi
md5cache=$(md5sum CACHE_KEY.txt | cut -c -32)
echo "CACHE_KEY=$md5cache" >> $GITHUB_ENV
mkdir -p Libraries
cd Libraries
echo "LibrariesPath=`pwd`" >> $GITHUB_ENV
wget -O tg_owt-version.json https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master
- name: Patches.
run: |
cd $LibrariesPath
git clone --depth=1 $GIT/desktop-app/patches.git
- name: Rnnoise.
run: |
cd $LibrariesPath
git clone --depth=1 https://gitlab.xiph.org/xiph/rnnoise.git
cd rnnoise
./autogen.sh
./configure --disable-examples --disable-doc
make -j$(nproc)
make install
- name: Setting up updater keys.
if: >
needs.check.outputs.update == 'true'
&& needs.check.outputs.packer == 'true'
env:
PACKER_PRIVATE_KEY: ${{ secrets.PACKER_PRIVATE_KEY }}
PACKER_PRIVATE_BETA_KEY: ${{ secrets.PACKER_PRIVATE_BETA_KEY }}
run: python3 buildscripts/scripts/updater_keys.py
- name: CMake.
run: |
cd $LibrariesPath
file=cmake-$CMAKE_VER-Linux-x86_64.sh
wget $GIT/Kitware/CMake/releases/download/v$CMAKE_VER/$file
mkdir /opt/cmake
sh $file --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
rm $file
cmake --version
- name: Meson.
run: |
python3 -m pip install meson==0.54.0
meson --version
- name: Ninja.
run: |
cd $LibrariesPath
wget $GIT/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
unzip ninja-linux.zip
chmod +x ninja
mv ninja /usr/local/bin
ninja --version
- name: MozJPEG.
run: |
cd $LibrariesPath
git clone -b v4.0.3 --depth=1 $GIT/mozilla/mozjpeg.git
cd mozjpeg
cmake -B build -GNinja . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DWITH_JPEG8=ON \
-DPNG_SUPPORTED=OFF
cmake --build build --parallel
cmake --install build
cd ..
rm -rf mozjpeg
- name: Opus cache.
id: cache-opus
uses: actions/cache@v2
if: ${{ needs.check.outputs.cache }}
with:
path: ${{ env.LibrariesPath }}/opus
key: ${{ runner.OS }}-opus-${{ env.CACHE_KEY }}
- name: Opus.
if: steps.cache-opus.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
git clone -b v1.3.1 --depth=1 $GIT/xiph/opus
cd opus
./autogen.sh
./configure
make -j$(nproc)
- name: Opus install.
run: |
cd $LibrariesPath/opus
make install
- name: VPX cache.
id: cache-vpx
uses: actions/cache@v2
if: ${{ needs.check.outputs.cache }}
with:
path: ${{ env.LibrariesPath }}/vpx-cache
key: ${{ runner.OS }}-vpx-${{ env.CACHE_KEY }}
- name: VPX build.
if: steps.cache-vpx.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
git clone -b v1.11.0 --depth=1 $GIT/webmproject/libvpx.git
cd libvpx
./configure \
--prefix=/usr \
--disable-examples \
--disable-unit-tests \
--disable-tools \
--disable-docs \
--enable-shared \
--disable-static \
--enable-vp8 \
--enable-vp9 \
--enable-webm-io
make -j$(nproc)
make DESTDIR="$LibrariesPath/vpx-cache" install
cd ..
rm -rf libvpx
- name: VPX install.
run: |
cd $LibrariesPath
cp -R vpx-cache/. /
ldconfig
- name: FFmpeg cache.
id: cache-ffmpeg
uses: actions/cache@v2
if: ${{ needs.check.outputs.cache }}
with:
path: ${{ env.LibrariesPath }}/ffmpeg-cache
key: ${{ runner.OS }}-ffmpeg-${{ env.CACHE_KEY }}
- name: FFmpeg build.
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
git clone --branch release/4.4 --depth=1 $GIT/FFmpeg/FFmpeg ffmpeg
cd ffmpeg
./configure \
--disable-static \
--disable-debug \
--disable-programs \
--disable-doc \
--disable-network \
--disable-autodetect \
--disable-encoders \
--disable-muxers \
--disable-bsfs \
--disable-protocols \
--disable-devices \
--disable-filters \
--enable-shared \
--enable-libopus \
--enable-libvpx \
--enable-protocol=file \
--enable-encoder=libopus \
--enable-muxer=ogg \
--enable-muxer=opus
make -j$(nproc)
make DESTDIR="$LibrariesPath/ffmpeg-cache" install
cd ..
rm -rf ffmpeg
- name: FFmpeg install.
run: |
cd $LibrariesPath
cp -R ffmpeg-cache/. /
ldconfig
- name: OpenAL Soft.
run: |
cd $LibrariesPath
git clone -b fix_pulse_default --depth=1 $GIT/telegramdesktop/openal-soft.git
cd openal-soft
cmake -B build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DALSOFT_EXAMPLES=OFF \
-DALSOFT_TESTS=OFF \
-DALSOFT_UTILS=OFF \
-DALSOFT_CONFIG=OFF
cmake --build build --parallel
cmake --install build
ldconfig
cd -
rm -rf openal-soft
- name: Libepoxy.
run: |
cd $LibrariesPath
git clone -b 1.5.9 --depth=1 $GIT/anholt/libepoxy.git
cd libepoxy
git apply ../patches/libepoxy.patch
meson build \
--buildtype=release \
--default-library=static \
-Dtests=false
meson compile -C build
meson install -C build
cd ..
rm -rf libepoxy
- name: Qt 6.2.3 cache.
id: cache-qt
uses: actions/cache@v2
if: ${{ needs.check.outputs.cache }}
with:
path: ${{ env.LibrariesPath }}/qt-cache
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_6_2_3/*') }}-${{ hashFiles('**/qtwayland_6_2_3/*') }}-${{ hashFiles('**/qt5compat_6_2_3/*') }}
- name: Qt 6.2.3 build.
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
git clone -b v6.2.3 --depth=1 git://code.qt.io/qt/qt5.git qt_${QT}
cd qt_${QT}
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qt5compat,qttools
cd qtbase
find ../../patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply
cd ../qtwayland
find ../../patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply
cd ../qt5compat
find ../../patches/qt5compat_${QT} -type f -print0 | sort -z | xargs -r0 git apply
cd ..
./configure -prefix /usr/local \
-release \
-opensource \
-confirm-license \
-qt-libpng \
-qt-harfbuzz \
-qt-pcre \
-no-feature-xcb-sm \
-no-feature-highdpiscaling \
-openssl-linked \
-nomake examples \
-nomake tests
cmake --build . --parallel
DESTDIR="$LibrariesPath/qt-cache" cmake --install .
cd ..
rm -rf qt_${QT}
- name: Qt 6.2.3 install.
run: |
cd $LibrariesPath
cp -R qt-cache/. /
ldconfig
- name: Qt6Gtk2.
run: |
cd $LibrariesPath
git clone -b 0.1 --depth=1 $GIT/trialuser02/qt6gtk2.git
cd qt6gtk2
wget https://github.com/trialuser02/qt6gtk2/commit/3d2cf8cbade92a175b2c878090f5f44a1b8a395c.patch
git apply 3d2cf8cbade92a175b2c878090f5f44a1b8a395c.patch
qmake
make -j$(nproc)
make install
cd ..
rm -rf qt6gtk2
- name: Qt6Ct.
run: |
cd $LibrariesPath
git clone -b 0.5 --depth=1 $GIT/trialuser02/qt6ct.git
cd qt6ct
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
cmake --install build
cd ..
rm -rf qt6ct
- name: Kvantum.
run: |
cd $LibrariesPath
git clone -b V1.0.0 --depth=1 $GIT/tsujan/Kvantum.git
cd Kvantum/Kvantum
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_QT5=OFF
cmake --build build --parallel
cmake --install build
cd ../..
rm -rf Kvantum
- name: WebRTC cache.
id: cache-webrtc
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/tg_owt
key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ hashFiles('**/tg_owt-version.json') }}
- name: WebRTC.
if: steps.cache-webrtc.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
mkdir tg_owt
cd tg_owt
git init
git remote add origin $GIT/desktop-app/tg_owt.git
git fetch --depth=1 origin 4cba1acdd718b700bb33945c0258283689d4eac7
git reset --hard FETCH_HEAD
git submodule init
git submodule update
cd src/third_party/pipewire
meson build -Dspa-plugins=disabled
cd ../../..
cmake -B build -GNinja . \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DTG_OWT_DLOPEN_PIPEWIRE=ON
cmake --build build --parallel
- name: Kotatogram Desktop build.
if: needs.check.outputs.cacheonly == 'false'
env:
API_ID: ${{ secrets.API_ID }}
API_HASH: ${{ secrets.API_HASH }}
tg_owt_DIR: ${{ env.LibrariesPath }}/tg_owt/build
run: |
cd $REPO_NAME/Telegram
UPDDEFINE="OFF"
${{ needs.check.outputs.update }} || UPDDEFINE="ON"
PACKERDEFINE="ON"
${{ needs.check.outputs.packer }} || PACKERDEFINE="OFF"
./configure.sh \
-DCMAKE_INSTALL_PREFIX=/usr \
-DTDESKTOP_API_ID=${API_ID} \
-DTDESKTOP_API_HASH=${API_HASH} \
-DDESKTOP_APP_DISABLE_AUTOUPDATE=${UPDDEFINE} \
-DKTGDESKTOP_ENABLE_PACKER=${PACKERDEFINE} \
-DDESKTOP_APP_USE_PACKAGED_LAZY=ON
cmake --build ../out --config Release --parallel
DESTDIR=../AppDir cmake --install ../out --config Release
- name: AppImage build.
if: needs.check.outputs.cacheonly == 'false'
run: |
# Let appimagetool determine the repository
cd $REPO_NAME
../linuxdeployqt-continuous-x86_64.AppImage \
AppDir/usr/share/applications/*.desktop \
-appimage \
-exclude-libs=libatk-1.0.so.0,libatk-bridge-2.0.so.0,libatspi.so.0,libcairo-gobject.so.2,libcairo.so.2,libgdk-3.so.0,libgdk_pixbuf-2.0.so.0,libgdk-x11-2.0.so.0,libgmodule-2.0.so.0,libgtk-3.so.0,libgtk-x11-2.0.so.0,libpixman-1.so.0,libpng12.so.0 \
-extra-plugins=iconengines,imageformats,platforminputcontexts,platforms/libqwayland-egl.so,platforms/libqwayland-generic.so,platforms/libqxcb.so,platformthemes/libqgtk3.so,platformthemes/libqxdgdesktopportal.so,platformthemes/libqt6ct.so,platformthemes/libqt6gtk2.so,styles/libqt6ct-style.so,styles/libqt6gtk2-style.so,styles/libkvantum.so,tls,wayland-decoration-client,wayland-graphics-integration-client,wayland-shell-integration,xcbglintegrations
appimage_name=$(echo Kotatogram_Desktop*.AppImage)
artifact_name=${{ env.VERSION_STR }}-linux.tar.xz
echo "APPIMAGE_NAME=$appimage_name" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$artifact_name" >> $GITHUB_ENV
# We don't need AppImageLauncher's desktop integration due to bad UX
dd if=/dev/zero of=$appimage_name bs=1 count=3 seek=8 conv=notrunc
- name: Check.
if: needs.check.outputs.cacheonly == 'false'
run: |
filePath="$REPO_NAME/$APPIMAGE_NAME"
if test -f "$filePath"; then
echo "Build successfully done! :)"
size=$(stat -c %s "$filePath")
echo "File size of ${filePath}: ${size} Bytes."
else
echo "Build error, output file does not exist."
exit 1
fi
- name: Move artifact.
if: needs.check.outputs.cacheonly == 'false'
run: |
cd $REPO_NAME
mkdir -p artifact/Kotatogram
TARGET_NAME="Kotatogram"
ARTIFACT_POSTFIX=" (Linux)"
mv $APPIMAGE_NAME artifact/Kotatogram/$TARGET_NAME
echo ""TARGET_ARTIFACT=$TARGET_NAME"" >> $GITHUB_ENV
echo ""ARTIFACT_POSTFIX=$ARTIFACT_POSTFIX"" >> $GITHUB_ENV
${{ needs.check.outputs.update }} && mv out/Release/Updater artifact/Kotatogram
cd artifact
tar -caf $ARTIFACT_NAME Kotatogram
- name: Upload artifact.
if: needs.check.outputs.cacheonly == 'false'
uses: actions/upload-artifact@v2
with:
path: ./${{ env.REPO_NAME }}/artifact/Kotatogram
name: Binary${{ env.ARTIFACT_POSTFIX }}
- name: Install dependencies for Telegram uploader.
if: >
needs.check.outputs.cacheonly == 'false'
&& needs.check.outputs.telegram == 'true'
run: |
python3 -m pip install telethon cryptg
- name: Upload binary to Telegram.
if: >
needs.check.outputs.cacheonly == 'false'
&& needs.check.outputs.telegram == 'true'
env:
TELETHON_API_ID: ${{ secrets.TELETHON_API_ID }}
TELETHON_API_HASH: ${{ secrets.TELETHON_API_HASH }}
TELETHON_SESSION: ${{ secrets.TELETHON_SESSION }}
run: >
python3 buildscripts/scripts/uploader.py
"@ktgbuilds"
"${{ env.REPO_NAME }}/artifact/${{ env.ARTIFACT_NAME }}"
"#Linux"
- name: Package update.
if: >
needs.check.outputs.cacheonly == 'false'
&& needs.check.outputs.update == 'true'
&& needs.check.outputs.packer == 'true'
run: |
cd $REPO_NAME
./out/Release/Packer -version ${{ env.VERSION_NUM }}${{ env.PACKER_BETA }} \
-path artifact/Kotatogram/${{ env.TARGET_ARTIFACT }} \
-path artifact/Kotatogram/Updater
tar -caf tlinuxupd${{ env.VERSION_NUM }}.tar.xz tlinuxupd${{ env.VERSION_NUM }}
echo ""UPDATE_FILE=tlinuxupd${{ env.VERSION_NUM }}"" >> $GITHUB_ENV
- name: Upload update artifact.
uses: actions/upload-artifact@v2
if: >
needs.check.outputs.cacheonly == 'false'
&& needs.check.outputs.update == 'true'
&& needs.check.outputs.packer == 'true'
with:
path: ./${{ env.REPO_NAME }}/${{ env.UPDATE_FILE }}
name: Update file${{ env.ARTIFACT_POSTFIX }}
- name: Upload update to Telegram.
if: >
needs.check.outputs.cacheonly == 'false'
&& needs.check.outputs.update == 'true'
&& needs.check.outputs.packer == 'true'
&& needs.check.outputs.telegram == 'true'
env:
TELETHON_API_ID: ${{ secrets.TELETHON_API_ID }}
TELETHON_API_HASH: ${{ secrets.TELETHON_API_HASH }}
TELETHON_SESSION: ${{ secrets.TELETHON_SESSION }}
run: >
python3 buildscripts/scripts/uploader.py
"@ktghbcfiles"
"${{ env.REPO_NAME }}/${{ env.UPDATE_FILE }}"
"${{ needs.check.outputs.description }}"