tdesktop/.github/workflows/win.yml

192 lines
5.7 KiB
YAML
Raw Normal View History

name: Windows.
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/win.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/docker/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/SourceFiles/platform/linux/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.sh'
- 'Telegram/Telegram.plist'
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/win.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/docker/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/SourceFiles/platform/linux/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.sh'
- 'Telegram/Telegram.plist'
jobs:
windows:
name: Windows
runs-on: windows-2022
strategy:
matrix:
arch: [Win32, x64]
2023-11-27 00:44:45 +00:00
generator: ["", "Ninja Multi-Config"]
env:
2024-04-03 15:09:00 +00:00
UPLOAD_ARTIFACT: "true"
ONLY_CACHE: "false"
2021-09-10 13:19:07 +00:00
PREPARE_PATH: "Telegram/build/prepare/prepare.py"
2020-02-24 13:51:53 +00:00
2020-10-25 01:46:27 +00:00
defaults:
run:
shell: cmd
steps:
- name: Prepare directories.
run: |
2023-08-22 02:11:50 +00:00
mkdir %userprofile%\TBuild\Libraries
2022-11-07 12:32:59 +00:00
mklink /d %GITHUB_WORKSPACE%\TBuild %userprofile%\TBuild
echo TBUILD=%GITHUB_WORKSPACE%\TBuild>>%GITHUB_ENV%
- name: Get repository name.
shell: bash
2020-10-25 01:46:27 +00:00
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
2022-11-07 12:32:59 +00:00
- uses: ilammy/msvc-dev-cmd@v1.12.0
name: Native Tools Command Prompt.
2021-08-11 02:52:44 +00:00
with:
arch: ${{ matrix.arch }}
2020-10-25 01:46:27 +00:00
- name: Clone.
2022-11-07 12:32:59 +00:00
uses: actions/checkout@v3.1.0
2020-10-25 01:46:27 +00:00
with:
submodules: recursive
path: ${{ env.TBUILD }}\${{ env.REPO_NAME }}
- name: Set up environment paths.
shell: bash
run: |
echo "CACHE_KEY=$(sha256sum $TBUILD/$REPO_NAME/$PREPARE_PATH | awk '{ print $1 }')" >> $GITHUB_ENV
echo "Configurate git for cherry-picks."
git config --global user.email "you@example.com"
git config --global user.name "Sample"
- name: NuGet sources.
2020-10-07 02:21:20 +00:00
run: |
nuget sources Disable -Name "Microsoft Visual Studio Offline Packages"
nuget sources Add -Source https://api.nuget.org/v3/index.json & exit 0
2020-10-07 02:21:20 +00:00
- name: Libraries cache.
id: cache-libs
2022-11-07 12:32:59 +00:00
uses: actions/cache@v3.0.11
with:
2023-08-22 02:11:50 +00:00
path: ${{ env.TBUILD }}\Libraries
key: ${{ runner.OS }}-${{ matrix.arch }}-libs-${{ env.CACHE_KEY }}
restore-keys: ${{ runner.OS }}-${{ matrix.arch }}-libs-
- name: Libraries.
env:
GYP_MSVS_OVERRIDE_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\'
GYP_MSVS_VERSION: 2022
2023-08-22 02:11:50 +00:00
run: |
cd %TBUILD%
%REPO_NAME%\Telegram\build\prepare\win.bat skip-release silent
2020-08-14 06:45:41 +00:00
2023-11-27 00:44:45 +00:00
- name: Read configuration matrix.
shell: bash
run: |
2023-11-27 00:44:45 +00:00
ARTIFACT_NAME="Telegram"
ARCH=""
if [ -n "${{ matrix.arch }}" ]; then
case "${{ matrix.arch }}" in
Win32) ARCH="x86";;
*) ARCH="${{ matrix.arch }}";;
esac
echo "Architecture from matrix: $ARCH"
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.arch }}"
fi
GENERATOR=""
if [ -n "${{ matrix.generator }}" ]; then
GENERATOR="-G \"${{ matrix.generator }}\""
echo "Generator from matrix: $GENERATOR"
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.generator }}"
fi
echo "TDESKTOP_BUILD_GENERATOR=$GENERATOR" >> $GITHUB_ENV
[ -n "$GENERATOR" ] && ARCH=""
echo "TDESKTOP_BUILD_ARCH=$ARCH" >> $GITHUB_ENV
DEFINE=""
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo "Define from matrix: $DEFINE"
2023-11-27 00:44:45 +00:00
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.defines }}"
fi
2020-10-25 01:46:27 +00:00
echo "TDESKTOP_BUILD_DEFINE=$DEFINE" >> $GITHUB_ENV
2023-11-27 00:44:45 +00:00
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
API="-D TDESKTOP_API_TEST=ON"
if [ $GITHUB_REF == 'refs/heads/nightly' ]; then
echo "Use the open credentials."
API="-D TDESKTOP_API_ID=611335 -D TDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
fi
echo "TDESKTOP_BUILD_API=$API" >> $GITHUB_ENV
2021-06-01 17:22:10 +00:00
- name: Free up some disk space.
run: |
2023-08-22 02:11:50 +00:00
cd %TBUILD%
del /S Libraries\*.pdb
del /S Libraries\*.pch
del /S Libraries\*.obj
2021-06-01 17:22:10 +00:00
- name: Telegram Desktop build.
if: env.ONLY_CACHE == 'false'
run: |
cd %TBUILD%\%REPO_NAME%\Telegram
call configure.bat ^
2023-11-27 00:44:45 +00:00
%TDESKTOP_BUILD_GENERATOR% ^
%TDESKTOP_BUILD_ARCH% ^
%TDESKTOP_BUILD_API% ^
2023-12-31 09:29:54 +00:00
-D DESKTOP_APP_DISABLE_AUTOUPDATE=OFF ^
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^
2021-03-17 09:45:19 +00:00
-D DESKTOP_APP_NO_PDB=ON ^
2023-11-27 00:44:45 +00:00
%TDESKTOP_BUILD_DEFINE%
2023-11-27 00:44:45 +00:00
cmake --build ..\out --config Debug --parallel
- name: Move artifact.
if: (env.UPLOAD_ARTIFACT == 'true') || (github.ref == 'refs/heads/nightly')
run: |
2023-12-31 09:29:54 +00:00
set OUT=%TBUILD%\%REPO_NAME%\out\Debug
mkdir artifact
2023-12-31 09:29:54 +00:00
move %OUT%\Telegram.exe artifact/
move %OUT%\Updater.exe artifact/
- uses: actions/upload-artifact@master
name: Upload artifact.
if: (env.UPLOAD_ARTIFACT == 'true') || (github.ref == 'refs/heads/nightly')
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifact\