name: Linux. on: push: paths-ignore: - 'docs/**' - '**.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' - '.github/**' - '!.github/workflows/linux.yml' - 'snap/**' - 'Telegram/build/**' - '!Telegram/build/docker/centos_env/**' - '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' - 'changelog.txt' - 'LEGAL' - 'LICENSE' - '.github/**' - '!.github/workflows/linux.yml' - 'snap/**' - 'Telegram/build/**' - '!Telegram/build/docker/centos_env/**' - '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: Rocky Linux 8 runs-on: ${{ (github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/nightly') && 'depot-ubuntu-latest-16' || 'ubuntu-latest' }} strategy: matrix: defines: - "" - "DESKTOP_APP_DISABLE_X11_INTEGRATION" env: UPLOAD_ARTIFACT: "true" ONLY_CACHE: "false" IMAGE_TAG: tdesktop:centos_env steps: - name: Clone. uses: actions/checkout@v7 with: submodules: recursive - name: First set up. run: | echo "WEEK=$(date -u +%G%V)" >> $GITHUB_ENV sudo apt update curl -sSL https://install.python-poetry.org | python3 - cd Telegram/build/docker/centos_env poetry install DOCKERFILE=$(DEBUG= LTO= poetry run gen_dockerfile) echo "$DOCKERFILE" > Dockerfile rm -rf __pycache__ - name: Free up some disk space. uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be with: tool-cache: true - name: Set up Docker Buildx. id: setup-buildx uses: docker/setup-buildx-action@v4 - name: Libraries cache. id: cache-libs uses: actions/cache@v6 with: path: | ${{ runner.temp }}/.buildx-cache ${{ runner.temp }}/.mount-cache key: ${{ runner.OS }}-libs-${{ hashFiles('Telegram/build/docker/centos_env/**') }} restore-keys: ${{ runner.OS }}-libs- - name: Restore Docker cache mounts. uses: reproducible-containers/buildkit-cache-dance@5422eac04292c961a382e0f584ea0f03ad9da723 with: builder: ${{ steps.setup-buildx.outputs.name }} cache-dir: ${{ runner.temp }}/.mount-cache dockerfile: Telegram/build/docker/centos_env/Dockerfile skip-extraction: ${{ steps.cache-libs.outputs.cache-hit }} - name: Libraries. uses: docker/build-push-action@v7 with: context: Telegram/build/docker/centos_env load: ${{ env.ONLY_CACHE == 'false' }} tags: ${{ env.IMAGE_TAG }} cache-from: type=local,src=${{ runner.temp }}/.buildx-cache cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max - name: Move cache. run: | rm -rf ${{ runner.temp }}/.buildx-cache mv ${{ runner.temp }}/.buildx-cache{-new,} - name: Restore Telegram Desktop cache. id: cache-tdesktop if: env.ONLY_CACHE == 'false' uses: actions/cache/restore@v6 with: path: ${{ runner.temp }}/.tdesktop-cache key: ${{ runner.OS }}-tdesktop-${{ matrix.defines || 'null' }}-${{ env.WEEK }} restore-keys: ${{ runner.OS }}-tdesktop-${{ matrix.defines || 'null' }}- - name: Telegram Desktop build. if: env.ONLY_CACHE == 'false' run: | DEFINE="" if [ -n "${{ matrix.defines }}" ]; then DEFINE="-D ${{ matrix.defines }}=ON" echo Define from matrix: $DEFINE echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV else echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV fi mkdir -p ${{ runner.temp }}/.tdesktop-cache docker run --rm \ -u $(id -u) \ -v $PWD:/usr/src/tdesktop \ -v ${{ runner.temp }}/.tdesktop-cache:/var/cache/ccache \ -e CONFIG=Debug \ -e CCACHE_SLOPPINESS=pch_defines,time_macros \ $IMAGE_TAG \ env -u CCACHE_DISABLE /usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \ -D CMAKE_CONFIGURATION_TYPES=Debug \ -D CMAKE_C_FLAGS_DEBUG="-O0 -fpch-preprocess" \ -D CMAKE_CXX_FLAGS_DEBUG="-O0 -fpch-preprocess" \ -D CMAKE_COMPILE_WARNING_AS_ERROR=ON \ -D TDESKTOP_API_TEST=ON \ -D DESKTOP_APP_DISABLE_AUTOUPDATE=OFF \ -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \ $DEFINE - name: Save Telegram Desktop cache. if: > github.ref_name == github.event.repository.default_branch && steps.cache-tdesktop.outputs.cache-hit != 'true' && env.ONLY_CACHE == 'false' uses: actions/cache/save@v6 with: path: ${{ runner.temp }}/.tdesktop-cache key: ${{ steps.cache-tdesktop.outputs.cache-primary-key }} - name: Check. if: env.ONLY_CACHE == 'false' run: | filePath="out/Debug/Telegram" 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 out/Debug mkdir artifact mv {Telegram,Updater} artifact/ - uses: actions/upload-artifact@v7 if: env.UPLOAD_ARTIFACT == 'true' name: Upload artifact. with: name: ${{ env.ARTIFACT_NAME }} path: out/Debug/artifact/