tdesktop/.github/workflows/snap.yml

100 lines
2.8 KiB
YAML
Raw Normal View History

2020-01-25 05:44:58 +00:00
name: Snap.
on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
linux:
name: Ubuntu 18.04
runs-on: ubuntu-18.04
env:
UPLOAD_ARTIFACT: "false"
ONLY_CACHE: "false"
MANUAL_CACHING: "3"
steps:
- name: Clone.
uses: actions/checkout@v1
with:
submodules: recursive
- name: First set up.
run: |
sudo apt-get update
sudo apt-get install gcc-8 g++-8 -y
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 /
snapcraft --version > CACHE_KEY.txt
gcc-8 --version >> CACHE_KEY.txt
echo $MANUAL_CACHING >> CACHE_KEY.txt
md5cache=$(md5sum CACHE_KEY.txt | cut -c -32)
echo ::set-env name=CACHE_KEY::$md5cache
awk -v RS="" -v ORS="\n\n" '/^ cmake:/' snap/snapcraft.yaml > CMAKE_CACHE_KEY.txt
md5cache=$(md5sum CMAKE_CACHE_KEY.txt | cut -c -32)
echo ::set-env name=CMAKE_CACHE_KEY::$md5cache
2020-03-09 07:11:12 +00:00
awk -v RS="" -v ORS="\n\n" '/^ ffmpeg:/' snap/snapcraft.yaml > FFMPEG_CACHE_KEY.txt
md5cache=$(md5sum FFMPEG_CACHE_KEY.txt | cut -c -32)
echo ::set-env name=FFMPEG_CACHE_KEY::$md5cache
2020-01-25 05:44:58 +00:00
- name: CMake cache.
id: cache-cmake
uses: actions/cache@v1
with:
path: parts/cmake
key: ${{ runner.OS }}-cmake-${{ env.CACHE_KEY }}-${{ env.CMAKE_CACHE_KEY }}
- name: CMake build.
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: snapcraft build --destructive-mode cmake
2020-03-09 07:11:12 +00:00
- name: FFmpeg cache.
id: cache-ffmpeg
uses: actions/cache@v1
with:
path: parts/ffmpeg
key: ${{ runner.OS }}-ffmpeg-${{ env.CACHE_KEY }}-${{ env.FFMPEG_CACHE_KEY }}
- name: FFmpeg build.
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: snapcraft build --destructive-mode ffmpeg
2020-01-25 05:44:58 +00:00
- name: Telegram Desktop snap build.
if: env.ONLY_CACHE == 'false'
run: snapcraft --destructive-mode
- name: Move artifact.
if: env.UPLOAD_ARTIFACT == 'true'
run: |
artifact_name=$(echo telegram-desktop_*.snap)
echo ::set-env name=ARTIFACT_NAME::$artifact_name
mkdir artifact
mv $artifact_name artifact
- uses: actions/upload-artifact@master
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifact
- name: Remove unneeded directories for cache.
run: |
2020-03-09 07:11:12 +00:00
rm -rf parts/{cmake,ffmpeg}/{build,src,ubuntu}
rm -rf parts/{cmake,ffmpeg}/state/{stage,prime}