name: AppImage. on: push: paths-ignore: - 'docs/**' - '**.md' - '!docs/building-cmake.md' - 'kotatogram_changes.txt' - 'changelog.txt' - 'LEGAL' - 'LICENSE' - '.github/**' - '!.github/workflows/appimage.yml' - 'snap/**' - 'Telegram/build/**' - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' - 'Telegram/SourceFiles/platform/mac/**' - 'Telegram/Telegram/**' - 'Telegram/configure.bat' - 'Telegram/Telegram.plist' pull_request: paths-ignore: - 'docs/**' - '**.md' - '!docs/building-cmake.md' - 'kotatogram_changes.txt' - 'changelog.txt' - 'LEGAL' - 'LICENSE' - '.github/**' - '!.github/workflows/appimage.yml' - 'snap/**' - 'Telegram/build/**' - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' - 'Telegram/SourceFiles/platform/mac/**' - 'Telegram/Telegram/**' - 'Telegram/configure.bat' - 'Telegram/Telegram.plist' jobs: linux: name: Ubuntu 14.04 if: > !(github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]')) && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) runs-on: ubuntu-latest container: image: ubuntu:trusty options: --privileged --device /dev/fuse strategy: matrix: defines: - "" - "DESKTOP_APP_DISABLE_DBUS_INTEGRATION" - "TDESKTOP_DISABLE_GTK_INTEGRATION" env: GIT: "https://github.com" QT: "5_12_8" OPENSSL_VER: "1_1_1" CMAKE_VER: "3.17.0" UPLOAD_ARTIFACT: "false" ONLY_CACHE: "false" MANUAL_CACHING: "1" DOC_PATH: "docs/building-cmake.md" AUTO_CACHING: "1" CXX: "g++ -static-libstdc++" steps: - name: Get repository name. run: echo ::set-env name=REPO_NAME::${GITHUB_REPOSITORY##*/} - name: Disable man for further package installs. run: | cfgFile="/etc/dpkg/dpkg.cfg.d/no_man" sudo touch $cfgFile p() { sudo echo "path-exclude=/usr/share/$1/*" >> $cfgFile } p man p locale p doc - name: Apt install. shell: bash run: | sudo apt-get update sudo apt-get install software-properties-common -y && \ sudo add-apt-repository ppa:git-core/ppa -y && \ sudo apt-get update && \ sudo apt-get install libice-dev libsm-dev libicu-dev liblzma-dev zlib1g-dev \ git wget autoconf automake build-essential libtool pkg-config bison yasm \ libasound2-dev libpulse-dev portaudio19-dev libdrm-dev libfuse2 \ libgtk-3-dev libgtk2.0-dev libatspi2.0-dev libgl1-mesa-dev libegl1-mesa-dev \ libffi-dev libxcb1-dev libxcb-keysyms1-dev libxcb-res0-dev libxcb-screensaver0-dev \ libxcb-xkb-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev \ xutils-dev libva-dev libvdpau-dev libjpeg-dev unzip -y --force-yes && \ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ sudo apt-get update && \ sudo apt-get install gcc-8 g++-8 -y && \ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 && \ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 60 && \ sudo update-alternatives --config gcc && \ sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y - name: Clone. uses: actions/checkout@v2 with: submodules: recursive path: ${{ env.REPO_NAME }} - name: First set up. shell: bash run: | wget -c -nv "https://github.com/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=$REPO_NAME/.github/workflows/appimage.yml echo `md5sum $thisFile | cut -c -32` >> CACHE_KEY.txt fi md5cache=$(md5sum CACHE_KEY.txt | cut -c -32) echo ::set-env name=CACHE_KEY::$md5cache mkdir -p Libraries cd Libraries echo ::set-env name=LibrariesPath::`pwd` - name: Patches. run: | echo "Find necessary commit from doc." checkoutCommit=$(grep -A 1 "cd patches" $REPO_NAME/$DOC_PATH | sed -n 2p) cd $LibrariesPath git clone $GIT/desktop-app/patches.git cd patches eval $checkoutCommit - name: OpenSSL cache. id: cache-openssl uses: actions/cache@v2 with: path: ${{ env.LibrariesPath }}/openssl-cache key: ${{ runner.OS }}-${{ env.OPENSSL_VER }}-${{ env.CACHE_KEY }} - name: OpenSSL build. if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd $LibrariesPath opensslDir=openssl_${OPENSSL_VER} git clone -b OpenSSL_${OPENSSL_VER}-stable --depth=1 \ $GIT/openssl/openssl $opensslDir cd $opensslDir ./config no-tests make -j$(nproc) sudo make DESTDIR="$LibrariesPath/openssl-cache" install_sw cd .. rm -rf $opensslDir - name: OpenSSL install. run: | cd $LibrariesPath sudo cp -R openssl-cache/. / sudo ldconfig - name: Python 3.8 cache. id: cache-python uses: actions/cache@v2 with: path: ${{ env.LibrariesPath }}/python-cache key: ${{ runner.OS }}-python-${{ env.CACHE_KEY }} - name: Python 3.8 build. if: steps.cache-python.outputs.cache-hit != 'true' run: | cd $LibrariesPath git clone -b v3.8.2 --depth=1 $GIT/python/cpython.git cd cpython ./configure --enable-optimizations make -j$(nproc) sudo make DESTDIR="$LibrariesPath/python-cache" install cd .. rm -rf cpython - name: Python 3.8 install. run: | cd $LibrariesPath sudo cp -R python-cache/. / - name: CMake. run: | cd $LibrariesPath file=cmake-$CMAKE_VER-Linux-x86_64.sh wget $GIT/Kitware/CMake/releases/download/v$CMAKE_VER/$file sudo mkdir /opt/cmake sudo sh $file --prefix=/opt/cmake --skip-license sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake rm $file cmake --version - name: Extra CMake Modules. run: | cd $LibrariesPath git clone -b v5.69.0 --depth=1 $GIT/KDE/extra-cmake-modules.git cd extra-cmake-modules cmake . -DCMAKE_BUILD_TYPE=Release cmake --build . -j$(nproc) sudo cmake --install . cd .. rm -rf extra-cmake-modules - name: Meson. run: | sudo python3 -m pip install meson==0.54.0 meson --version - name: Ninja. run: | cd $LibrariesPath wget https://github.com/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: NASM. run: | cd $LibrariesPath git clone -b nasm-2.14.02 --depth=1 https://repo.or.cz/nasm.git cd nasm ./autogen.sh ./configure make -j$(nproc) sudo install nasm /usr/local/bin/nasm sudo install ndisasm /usr/local/bin/ndisasm cd .. rm -rf nasm - name: Dav1d. run: | cd $LibrariesPath git clone -b 0.6.0 --depth=1 $GIT/videolan/dav1d.git cd dav1d mkdir build && cd build meson .. \ --libdir=/usr/local/lib \ -Denable_tools=false \ -Denable_tests=false ninja sudo ninja install sudo ldconfig cd ../.. rm -rf dav1d - name: Opus cache. id: cache-opus uses: actions/cache@v2 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 --depth=1 $GIT/xiph/opus cd opus ./autogen.sh ./configure make -j$(nproc) - name: Opus install. run: | cd $LibrariesPath/opus sudo make install - name: FFmpeg cache. id: cache-ffmpeg uses: actions/cache@v2 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.2 $GIT/FFmpeg/FFmpeg ffmpeg cd ffmpeg ./configure \ --disable-static \ --disable-debug \ --disable-programs \ --disable-doc \ --disable-network \ --disable-autodetect \ --disable-everything \ --disable-alsa \ --disable-iconv \ --enable-shared \ --enable-libdav1d \ --enable-libopus \ --enable-vaapi \ --enable-vdpau \ --enable-protocol=file \ --enable-hwaccel=h264_vaapi \ --enable-hwaccel=h264_vdpau \ --enable-hwaccel=mpeg4_vaapi \ --enable-hwaccel=mpeg4_vdpau \ --enable-decoder=aac \ --enable-decoder=aac_fixed \ --enable-decoder=aac_latm \ --enable-decoder=aasc \ --enable-decoder=alac \ --enable-decoder=flac \ --enable-decoder=gif \ --enable-decoder=h264 \ --enable-decoder=hevc \ --enable-decoder=libdav1d \ --enable-decoder=mp1 \ --enable-decoder=mp1float \ --enable-decoder=mp2 \ --enable-decoder=mp2float \ --enable-decoder=mp3 \ --enable-decoder=mp3adu \ --enable-decoder=mp3adufloat \ --enable-decoder=mp3float \ --enable-decoder=mp3on4 \ --enable-decoder=mp3on4float \ --enable-decoder=mpeg4 \ --enable-decoder=msmpeg4v2 \ --enable-decoder=msmpeg4v3 \ --enable-decoder=opus \ --enable-decoder=pcm_alaw \ --enable-decoder=pcm_f32be \ --enable-decoder=pcm_f32le \ --enable-decoder=pcm_f64be \ --enable-decoder=pcm_f64le \ --enable-decoder=pcm_lxf \ --enable-decoder=pcm_mulaw \ --enable-decoder=pcm_s16be \ --enable-decoder=pcm_s16be_planar \ --enable-decoder=pcm_s16le \ --enable-decoder=pcm_s16le_planar \ --enable-decoder=pcm_s24be \ --enable-decoder=pcm_s24daud \ --enable-decoder=pcm_s24le \ --enable-decoder=pcm_s24le_planar \ --enable-decoder=pcm_s32be \ --enable-decoder=pcm_s32le \ --enable-decoder=pcm_s32le_planar \ --enable-decoder=pcm_s64be \ --enable-decoder=pcm_s64le \ --enable-decoder=pcm_s8 \ --enable-decoder=pcm_s8_planar \ --enable-decoder=pcm_u16be \ --enable-decoder=pcm_u16le \ --enable-decoder=pcm_u24be \ --enable-decoder=pcm_u24le \ --enable-decoder=pcm_u32be \ --enable-decoder=pcm_u32le \ --enable-decoder=pcm_u8 \ --enable-decoder=pcm_zork \ --enable-decoder=vorbis \ --enable-decoder=wavpack \ --enable-decoder=wmalossless \ --enable-decoder=wmapro \ --enable-decoder=wmav1 \ --enable-decoder=wmav2 \ --enable-decoder=wmavoice \ --enable-encoder=libopus \ --enable-parser=aac \ --enable-parser=aac_latm \ --enable-parser=flac \ --enable-parser=h264 \ --enable-parser=hevc \ --enable-parser=mpeg4video \ --enable-parser=mpegaudio \ --enable-parser=opus \ --enable-parser=vorbis \ --enable-demuxer=aac \ --enable-demuxer=flac \ --enable-demuxer=gif \ --enable-demuxer=h264 \ --enable-demuxer=hevc \ --enable-demuxer=m4v \ --enable-demuxer=mov \ --enable-demuxer=mp3 \ --enable-demuxer=ogg \ --enable-demuxer=wav \ --enable-muxer=ogg \ --enable-muxer=opus make -j$(nproc) sudo make DESTDIR="$LibrariesPath/ffmpeg-cache" install cd .. rm -rf ffmpeg - name: FFmpeg install. run: | cd $LibrariesPath sudo cp -R ffmpeg-cache/. / sudo ldconfig - name: OpenAL Soft. run: | cd $LibrariesPath git clone -b openal-soft-1.20.1 --depth=1 $GIT/kcat/openal-soft.git cd openal-soft/build cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DALSOFT_EXAMPLES=OFF \ -DALSOFT_TESTS=OFF \ -DALSOFT_UTILS=OFF \ -DALSOFT_CONFIG=OFF cmake --build . -j$(nproc) sudo cmake --install . sudo ldconfig cd - rm -rf openal-soft - name: Libwayland. run: | cd $LibrariesPath git clone -b 1.18.0 https://gitlab.freedesktop.org/wayland/wayland cd wayland ./autogen.sh \ --disable-documentation \ --disable-dtd-validation make -j$(nproc) sudo make install sudo ldconfig cd .. rm -rf wayland - name: Libxkbcommon. run: | cd $LibrariesPath git clone -b xkbcommon-0.8.4 --depth=1 $GIT/xkbcommon/libxkbcommon.git cd libxkbcommon ./autogen.sh \ --disable-docs \ --disable-wayland \ --with-xkb-config-root=/usr/share/X11/xkb \ --with-x-locale-root=/usr/share/X11/locale make -j$(nproc) sudo make install sudo ldconfig cd .. rm -rf libxkbcommon - name: Qt 5.12.8 cache. id: cache-qt uses: actions/cache@v2 with: path: ${{ env.LibrariesPath }}/qt-cache key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qt*_5_12_8/*') }} - name: Qt 5.12.8 build. if: steps.cache-qt.outputs.cache-hit != 'true' run: | cd $LibrariesPath git clone -b v5.12.8 --depth=1 git://code.qt.io/qt/qt5.git qt_${QT} cd qt_${QT} perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qttools,qtx11extras git submodule update qtbase qtwayland qtimageformats qtsvg qttools qtx11extras cd qtbase find ../../patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply cd .. cd qtwayland find ../../patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply cd .. ./configure -prefix /usr/local \ -release \ -opensource \ -confirm-license \ -qt-zlib \ -qt-libpng \ -qt-libjpeg \ -qt-harfbuzz \ -qt-pcre \ -qt-xcb \ -openssl-linked \ OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto" \ QMAKE_CXX="$CXX" \ QMAKE_LINK="$CXX" \ -nomake examples \ -nomake tests make -j$(nproc) sudo make INSTALL_ROOT="$LibrariesPath/qt-cache" install cd .. rm -rf qt_${QT} - name: Qt 5.12.8 install. run: | cd $LibrariesPath sudo cp -R qt-cache/. / sudo ldconfig - name: Qt Style Plugins. run: | cd $LibrariesPath git clone --depth=1 git://code.qt.io/qt/qtstyleplugins.git cd qtstyleplugins git apply ../patches/qtstyleplugins.diff qmake make -j$(nproc) sudo make install cd .. rm -rf qtstyleplugins - name: KWindowSystem. run: | cd $LibrariesPath git clone -b v5.69.0 --depth=1 $GIT/KDE/kwindowsystem.git cd kwindowsystem cmake . \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=OFF \ -DKDE_INSTALL_LIBDIR=lib cmake --build . -j$(nproc) sudo cmake --install . sudo ldconfig cd .. rm -rf kwindowsystem - name: Kvantum. run: | cd $LibrariesPath git clone -b V0.15.3 --depth=1 $GIT/tsujan/Kvantum.git cd Kvantum/Kvantum cmake . -DCMAKE_BUILD_TYPE=Release cmake --build . -j$(nproc) sudo cmake --install . 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 }} - name: WebRTC. if: steps.cache-webrtc.outputs.cache-hit != 'true' run: | cd $LibrariesPath git clone $GIT/desktop-app/tg_owt.git cd tg_owt cmake -B build . -DCMAKE_BUILD_TYPE=Release cmake --build build -j$(nproc) - name: Kotatogram Desktop build. if: env.ONLY_CACHE == 'false' env: tg_owt_DIR: ${{ env.LibrariesPath }}/tg_owt/build run: | cd $REPO_NAME/Telegram DEFINE="" if [ -n "${{ matrix.defines }}" ]; then DEFINE="-D ${{ matrix.defines }}=ON" echo Define from matrix: $DEFINE echo ::set-env name=ARTIFACT_NAME::Kotatogram_${{ matrix.defines }} else echo ::set-env name=ARTIFACT_NAME::Kotatogram fi ./configure.sh \ -GNinja \ -DCMAKE_INSTALL_PREFIX=/usr \ -DTDESKTOP_API_TEST=ON \ -DDESKTOP_APP_USE_PACKAGED_LAZY=ON \ $DEFINE cd ../out/Release cmake --build . -j$(nproc) DESTDIR=../../AppDir cmake --install . - name: AppImage build. if: env.ONLY_CACHE == '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-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=bearer,iconengines,imageformats,platforminputcontexts,platforms/libqwayland-egl.so,platforms/libqwayland-generic.so,platformthemes/libqgtk3.so,platformthemes/libqxdgdesktopportal.so,styles/libkvantum.so,wayland-decoration-client,wayland-graphics-integration-client,wayland-shell-integration appimage_name=$(echo Kotatogram_Desktop*.AppImage) echo ::set-env name=APPIMAGE_NAME::$appimage_name # 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: env.ONLY_CACHE == '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: env.UPLOAD_ARTIFACT == 'true' run: | cd $REPO_NAME mkdir artifact mv $APPIMAGE_NAME artifact/ - uses: actions/upload-artifact@master if: env.UPLOAD_ARTIFACT == 'true' name: Upload artifact. with: name: ${{ env.ARTIFACT_NAME }} path: ${{ env.REPO_NAME }}/artifact/