From c690c3b72c2062c70ad7f4789b47898e3510d84b Mon Sep 17 00:00:00 2001 From: ilya-fedin Date: Mon, 30 Mar 2020 13:54:29 +0400 Subject: [PATCH] Add new GitHub actions (#15) --- .github/workflows/appimage-release.yml | 371 +++++++++++++++++++++++++ .github/workflows/release-tarball.yml | 38 +++ .github/workflows/snap-release.yml | 45 +++ snap/snapcraft.yaml | 11 +- 4 files changed, 455 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/appimage-release.yml create mode 100644 .github/workflows/release-tarball.yml create mode 100644 .github/workflows/snap-release.yml diff --git a/.github/workflows/appimage-release.yml b/.github/workflows/appimage-release.yml new file mode 100644 index 000000000..51476d47b --- /dev/null +++ b/.github/workflows/appimage-release.yml @@ -0,0 +1,371 @@ +name: Release AppImage + +on: + release: + types: [created] + +jobs: + + linux: + name: Ubuntu 14.04 + runs-on: ubuntu-latest + container: + image: ubuntu:trusty + options: --privileged --device /dev/fuse + + env: + GIT: "https://github.com" + CMAKE_VER: "3.17.0" + DOC_PATH: "docs/building-cmake.md" + + 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 add-apt-repository ppa:beineri/opt-qt-5.10.1-trusty -y && \ + sudo apt-get update && \ + sudo apt-get install liblzma-dev zlib1g-dev libssl-dev \ + git wget autoconf automake build-essential libtool pkg-config \ + libopus-dev libasound2-dev libpulse-dev portaudio19-dev \ + qt510base qt510imageformats qt510svg libfuse2 libgl1-mesa-dev \ + libva-dev libvdpau-dev python3 python3-pip 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 + + mkdir -p Libraries + cd Libraries + echo ::set-env name=LibrariesPath::`pwd` + + - 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 + + # TODO: AV1 support + # - name: Meson. + # run: | + # sudo python3 -m pip install meson==0.44.1 + # meson --version + + # TODO: AV1 support + # - 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 --prefix=/usr + make -j$(nproc) + sudo install nasm /usr/bin/nasm + sudo install ndisasm /usr/bin/ndisasm + cd .. + rm -rf nasm + + - name: Range-v3. + run: | + echo "Find necessary branch from doc." + cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p) + cd $LibrariesPath + echo $cloneRange + eval $cloneRange + cd range-v3 + + cmake . \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DRANGE_V3_TESTS=OFF \ + -DRANGE_V3_EXAMPLES=OFF \ + -DRANGE_V3_DOCS=OFF + + cmake --build . + cmake --install . + + cd .. + rm -rf range-v3 + + - name: MiniZip. + run: | + cd $LibrariesPath + + git clone -b v1.2.11 --depth=1 $GIT/madler/zlib.git + cd zlib/contrib/minizip + autoreconf -i + ./configure --prefix=/usr + make + sudo make install + cd ../../.. + rm -rf zlib + + - name: LZ4. + run: | + cd $LibrariesPath + + git clone -b v1.9.2 --depth=1 $GIT/lz4/lz4.git + cd lz4 + make -j$(nproc) + PREFIX=/usr sudo make install + cd .. + rm -rf lz4 + + - name: xxHash. + run: | + cd $LibrariesPath + + git clone -b v0.7.2 --depth=1 $GIT/Cyan4973/xxHash.git + cd xxHash + make -j$(nproc) + PREFIX=/usr sudo make install + cd .. + rm -rf xxHash + + # TODO: AV1 support + # - name: dav1d. + # run: | + # cd $LibrariesPath + + # git clone -b 0.6.0 --depth=1 $GIT/videolan/dav1d.git + # cd dav1d + # mkdir build && cd build + # meson --prefix=/usr .. + # ninja + # ninja install + # cd ../.. + # rm -rf dav1d + + - name: FFmpeg. + run: | + cd $LibrariesPath + + git clone --branch release/4.2 $GIT/FFmpeg/FFmpeg ffmpeg + cd ffmpeg + ./configure \ + --prefix=/usr \ + --disable-debug \ + --disable-programs \ + --disable-doc \ + --disable-autodetect \ + --disable-everything \ + --disable-neon \ + --disable-iconv \ + --enable-gpl \ + --enable-version3 \ + --enable-libopus \ + --enable-vaapi \ + --enable-vdpau \ + --enable-decoder=aac \ + --enable-decoder=aac_latm \ + --enable-decoder=aasc \ + --enable-decoder=flac \ + --enable-decoder=gif \ + --enable-decoder=h264 \ + --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=vorbis \ + --enable-decoder=wavpack \ + --enable-decoder=wmalossless \ + --enable-decoder=wmapro \ + --enable-decoder=wmav1 \ + --enable-decoder=wmav2 \ + --enable-decoder=wmavoice \ + --enable-encoder=libopus \ + --enable-hwaccel=h264_vaapi \ + --enable-hwaccel=h264_vdpau \ + --enable-hwaccel=mpeg4_vaapi \ + --enable-hwaccel=mpeg4_vdpau \ + --enable-parser=aac \ + --enable-parser=aac_latm \ + --enable-parser=flac \ + --enable-parser=h264 \ + --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=mov \ + --enable-demuxer=mp3 \ + --enable-demuxer=ogg \ + --enable-demuxer=wav \ + --enable-muxer=ogg \ + --enable-muxer=opus + + make -j$(nproc) + sudo make install + cd .. + rm -rf ffmpeg + + - 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_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DALSOFT_EXAMPLES=OFF \ + -DALSOFT_TESTS=OFF \ + -DALSOFT_UTILS=OFF \ + -DALSOFT_CONFIG=OFF + + cmake --build . + cmake --install . + cd - + rm -rf openal-soft + + - name: Hunspell. + run: | + cd $LibrariesPath + + git clone -b v1.7.0 --depth=1 $GIT/hunspell/hunspell.git + cd hunspell + autoreconf -vfi + ./configure --prefix=/usr + make + sudo make install + cd .. + rm -rf hunspell + + - name: libdbusmenu-qt. + shell: bash --noprofile --norc -o pipefail {0} + run: | + cd $LibrariesPath + + source /opt/qt*/bin/qt*-env.sh + export CMAKE_PREFIX_PATH=$QTDIR + + git clone -b 0.9.3+16.04.20160218-0ubuntu1 --depth=1 $GIT/unity8-team/libdbusmenu-qt.git + cd libdbusmenu-qt + cmake . \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DWITH_DOC=OFF + + cmake --build . + cmake --install . + cd .. + rm -rf libdbusmenu-qt + + - name: Kotatogram Desktop. + shell: bash --noprofile --norc -o pipefail {0} + run: | + cd $REPO_NAME + + mkdir AppDir + source /opt/qt*/bin/qt*-env.sh + export CMAKE_PREFIX_PATH=$QTDIR + + cmake . \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DTDESKTOP_API_TEST=ON \ + -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF \ + -DDESKTOP_APP_USE_PACKAGED_GSL=OFF \ + -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF \ + -DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF \ + -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF \ + -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF + + cmake --build . + DESTDIR=AppDir cmake --install . + + - name: Update linker cache. + run: sudo ldconfig + + - name: AppImage build. + shell: bash --noprofile --norc -o pipefail {0} + run: | + source /opt/qt*/bin/qt*-env.sh + + ./linuxdeployqt-continuous-x86_64.AppImage \ + $REPO_NAME/AppDir/usr/share/applications/*.desktop \ + -appimage \ + -extra-plugins=iconengines,imageformats,platformthemes/libqgtk3.so + + - name: Get artifact name + run: | + artifact_name=$(echo Kotatogram_Desktop*.AppImage) + echo ::set-env name=ARTIFACT_NAME::$artifact_name + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./${{ env.ARTIFACT_NAME }} + asset_name: ${{ env.ARTIFACT_NAME }} + asset_content_type: application/octet-stream diff --git a/.github/workflows/release-tarball.yml b/.github/workflows/release-tarball.yml new file mode 100644 index 000000000..4142ad2f5 --- /dev/null +++ b/.github/workflows/release-tarball.yml @@ -0,0 +1,38 @@ +name: Release Tarball + +on: + release: + types: [created] + +jobs: + + linux: + name: Ubuntu + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + with: + submodules: recursive + + - name: Create tarball + run: | + tag_name=${GITHUB_REF##*/} + version=${tag_name#k} + artifact_name="kotatogram-desktop-$version-full.tar.gz" + echo ::set-env name=ARTIFACT_NAME::$artifact_name + + rm -rf .git + tar -caf "../$artifact_name" . + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ../${{ env.ARTIFACT_NAME }} + asset_name: ${{ env.ARTIFACT_NAME }} + asset_content_type: application/octet-stream diff --git a/.github/workflows/snap-release.yml b/.github/workflows/snap-release.yml new file mode 100644 index 000000000..916927cfb --- /dev/null +++ b/.github/workflows/snap-release.yml @@ -0,0 +1,45 @@ +name: Release Snap + +on: + release: + types: [created] + +jobs: + + linux: + name: Ubuntu 18.04 + runs-on: ubuntu-18.04 + + steps: + - name: Checkout + uses: actions/checkout@v1 + with: + submodules: recursive + + - name: First set up + run: | + sudo apt-get update + sudo snap install --classic snapcraft + + # Workaround for snapcraft + # See https://forum.snapcraft.io/t/permissions-problem-using-snapcraft-in-azure-pipelines/13258 + sudo chown root:root / + + - name: Kotatogram Desktop snap build + run: sudo snapcraft --destructive-mode + + - name: Get artifact name + run: | + artifact_name=$(echo kotatogram-desktop_*.snap) + echo ::set-env name=ARTIFACT_NAME::$artifact_name + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./${{ env.ARTIFACT_NAME }} + asset_name: ${{ env.ARTIFACT_NAME }} + asset_content_type: application/octet-stream diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index af22b2375..c15241153 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -105,16 +105,7 @@ parts: override-pull: | snapcraftctl pull - version_file=Telegram/build/version - version=$(sed -n "s/AppVersionStr[ ]\+\(.*\)\+/\1/p" $version_file) - beta=$(sed -n "s/BetaChannel[ ]\+\(.*\)\+/\1/p" $version_file) - - if [ "$beta" != "0" ]; then - version="$version-beta" - fi - - version="${version}$(git describe --tags | sed 's,^v[^-]\+,,')" - + version="$(git describe --tags | sed -r 's,^k([0-9]\.[0-9]),\1,')" snapcraftctl set-version "$version" sed -i 's|^Icon=.*|Icon=/share/icons/hicolor/512x512/apps/kotatogram.png|g' lib/xdg/kotatogramdesktop.desktop