Skip to content

Update linux.yml

Update linux.yml #13

Workflow file for this run

name: Yukigran-Build
on:
workflow_dispatch:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/linux.yml'
- 'snap/**'
- 'Telegram/build/**'
- '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/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: self-hosted
strategy:
matrix:
defines:
- ""
- "DESKTOP_APP_DISABLE_X11_INTEGRATION"
env:
UPLOAD_ARTIFACT: "true"
steps:
- name: Get repository name
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Trust main repo (pre-submodule)
run: |
git config --global --add safe.directory "${{ github.workspace }}/${{ env.REPO_NAME }}"
- name: Initialize submodules
run: |
cd "${{ env.REPO_NAME }}"
git submodule deinit -f .
git submodule update --init --recursive --depth=1
- name: Trust all submodule directories
run: |
find "${{ github.workspace }}/${{ env.REPO_NAME }}" -type d -name ".git" | while read gitdir; do
safe_dir=$(dirname "$gitdir")
echo "Adding to safe.directory: $safe_dir"
git config --global --add safe.directory "$safe_dir"
done
- name: Install jinja2-cli
run: |
pip install --user jinja2-cli
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Render Dockerfile
run: |
jinja2 \
${{ env.REPO_NAME }}/Telegram/build/docker/centos_env/Dockerfile \
-D GIT=https://github.com \
> ${{ env.REPO_NAME }}/Dockerfile.rendered
- name: Build Docker image locally
run: |
docker build \
-f ${{ env.REPO_NAME }}/Dockerfile.rendered \
-t tdesktop:centos_env \
${{ env.REPO_NAME }}
- name: Telegram Desktop build
run: |
cd $REPO_NAME
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
docker run --rm \
-u $(id -u) \
-v $PWD:/usr/src/tdesktop \
-e CONFIG=Release \
tdesktop:centos_env \
/usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
-D CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-D CMAKE_C_FLAGS_DEBUG="" \
-D CMAKE_CXX_FLAGS_DEBUG="" \
-D CMAKE_C_FLAGS="" \
-D CMAKE_CXX_FLAGS="" \
-D CMAKE_EXE_LINKER_FLAGS="-s" \
-D TDESKTOP_API_ID="${{ secrets.API_ID }}" \
-D TDESKTOP_API_HASH="${{ secrets.API_HASH }}" \
-D DESKTOP_APP_DISABLE_AUTOUPDATE=ON \
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
$DEFINE
- name: Check output binary
run: |
filePath="$REPO_NAME/out/Release/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
- uses: actions/upload-artifact@v4
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.REPO_NAME }}/out/Release/Telegram