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 - 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 - 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: | rm -rf parts/cmake/{build,src,ubuntu} rm -rf parts/cmake/state/{stage,prime}