tdesktop/.github/workflows/win.yml

483 lines
16 KiB
YAML
Raw Normal View History

name: Windows.
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- '!docs/building-win.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/win.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/**'
- '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'
- '!docs/building-win.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/win.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/**'
- '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-latest
strategy:
matrix:
defines:
- ""
env:
SDK: "10.0.18362.0"
GIT: "https://github.com"
2020-12-09 13:26:25 +00:00
QT_VER: "5.15.2"
OPENSSL_VER: "1_1_1"
UPLOAD_ARTIFACT: "false"
ONLY_CACHE: "false"
2021-08-11 02:52:44 +00:00
MANUAL_CACHING: "0"
DOC_PATH: "docs/building-win.md"
2020-02-24 13:51:53 +00:00
AUTO_CACHING: "1"
2020-10-25 01:46:27 +00:00
defaults:
run:
shell: cmd
2021-08-11 02:52:44 +00:00
working-directory: Libraries
2020-10-25 01:46:27 +00:00
steps:
- name: Get repository name.
shell: bash
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
2020-10-25 01:46:27 +00:00
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
2021-08-11 02:52:44 +00:00
- uses: ilammy/msvc-dev-cmd@v1.9.0
name: x86 Native Tools Command Prompt.
with:
arch: win32
2020-10-25 01:46:27 +00:00
- name: Set up environment paths.
shell: bash
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
run: |
2020-10-25 01:46:27 +00:00
echo "C:\\Strawberry\\perl\\bin\\" >> $GITHUB_PATH
echo "C:\\Program Files\\NASM\\" >> $GITHUB_PATH
echo "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\" >> $GITHUB_PATH
2020-10-25 01:46:27 +00:00
mkdir Libraries && cd Libraries
echo "Convert unix path to win path."
p=`pwd | sed 's#^/[d]#d:#g' |sed 's#/#\\\\#g'`
echo "LibrariesPath=$p" >> $GITHUB_ENV
2021-08-11 02:52:44 +00:00
echo "QT=${QT_VER//./_}" >> $GITHUB_ENV
2020-10-25 01:46:27 +00:00
- name: Save msbuild version.
run: |
call vcvars32.bat
msbuild -version > CACHE_KEY.txt
2020-10-25 01:46:27 +00:00
- name: Clone.
uses: actions/checkout@v2
with:
submodules: recursive
path: ${{ env.REPO_NAME }}
- name: Generate cache key.
shell: bash
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
run: |
curl -o $LibrariesPath/tg_owt-version.json https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master
2021-07-06 14:10:44 +00:00
curl -o $LibrariesPath/tg_angle-version.json https://api.github.com/repos/desktop-app/tg_angle/git/refs/heads/master
2020-10-25 01:46:27 +00:00
echo $MANUAL_CACHING >> CACHE_KEY.txt
2020-02-24 13:51:53 +00:00
if [ "$AUTO_CACHING" == "1" ]; then
thisFile=$REPO_NAME/.github/workflows/win.yml
echo `md5sum $thisFile | awk '{ print $1 }'` >> CACHE_KEY.txt
fi
2020-10-25 01:46:27 +00:00
echo "CACHE_KEY=`md5sum CACHE_KEY.txt | awk '{ print $1 }'`" >> $GITHUB_ENV
- name: Choco installs.
2021-08-11 02:52:44 +00:00
run: |
choco install --allow-empty-checksums --no-progress -y yasm
choco install --no-progress -y nasm jom ninja
python -m pip install pywin32
2021-04-27 12:08:41 +00:00
- name: NuGet sources.
run: |
nuget sources Disable -Name "Microsoft Visual Studio Offline Packages"
nuget sources Add -Source https://api.nuget.org/v3/index.json & exit 0
- name: Patches.
shell: bash
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
run: |
echo "Find necessary commit from doc."
checkoutCommit=$(grep -A 1 "cd patches" $REPO_NAME/$DOC_PATH | sed -n 2p)
cd $LibrariesPath
git clone $GIT/desktop-app/patches.git
cd Patches
eval $checkoutCommit
2020-08-14 06:45:41 +00:00
- name: Find any version of Python 2.
2020-10-25 01:46:27 +00:00
shell: bash
2020-08-14 06:45:41 +00:00
run: |
2020-10-25 01:46:27 +00:00
echo "Find any version of Python 2."
2021-03-17 09:45:19 +00:00
p=`ls /c/hostedtoolcache/windows/python | grep "^2" | tail -1`
2020-10-25 01:46:27 +00:00
if [ -z "$p" ]; then
echo "Python 2 is not found."
2020-08-14 06:45:41 +00:00
exit 1
2020-10-25 01:46:27 +00:00
fi
echo "PY2=C:\\hostedtoolcache\\windows\\Python\\$p\\x64" >> $GITHUB_ENV
echo "Found $p."
2020-08-14 06:45:41 +00:00
- name: LZMA.
run: |
git clone %GIT%/telegramdesktop/lzma.git
cd lzma
cd C\Util\LzmaLib
msbuild -m LzmaLib.sln /property:Configuration=Debug
- name: OpenSSL cache.
id: cache-openssl
2020-06-30 08:37:15 +00:00
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/openssl_${{ env.OPENSSL_VER }}
key: ${{ runner.OS }}-${{ env.CACHE_KEY }}-${{ env.OPENSSL_VER }}
- name: OpenSSL.
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: |
git clone %GIT%/openssl/openssl.git openssl_%OPENSSL_VER%
cd openssl_%OPENSSL_VER%
git checkout OpenSSL_%OPENSSL_VER%-stable
perl Configure no-shared no-tests debug-VC-WIN32
nmake
mkdir out32.dbg
move libcrypto.lib out32.dbg
move libssl.lib out32.dbg
move ossl_static.pdb out32.dbg\ossl_static
nmake clean
move out32.dbg\ossl_static out32.dbg\ossl_static.pdb
perl Configure no-shared no-tests VC-WIN32
nmake
mkdir out32
move libcrypto.lib out32
move libssl.lib out32
move ossl_static.pdb out32
rmdir /S /Q test
rmdir /S /Q .git
- name: Zlib.
run: |
git clone %GIT%/telegramdesktop/zlib.git
cd zlib
git checkout tdesktop
cd contrib\vstudio\vc14
msbuild -m zlibstat.vcxproj /property:Configuration=Debug
2020-10-07 02:21:20 +00:00
- name: MozJPEG.
shell: cmd
run: |
git clone -b v4.0.1-rc2 %GIT%/mozilla/mozjpeg.git
cd mozjpeg
cmake . ^
-G "Visual Studio 16 2019" ^
-A Win32 ^
-DWITH_JPEG8=ON ^
-DPNG_SUPPORTED=OFF
cmake --build . --config Debug
- name: OpenAL Soft cache.
id: cache-openal
2020-06-30 08:37:15 +00:00
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/openal-soft
key: ${{ runner.OS }}-openal-soft-${{ env.CACHE_KEY }}
- name: OpenAL Soft.
if: steps.cache-openal.outputs.cache-hit != 'true'
run: |
2020-12-09 13:26:25 +00:00
git clone -b openal-soft-1.21.0 --depth=1 %GIT%/kcat/openal-soft.git
2020-11-30 19:40:13 +00:00
cd openal-soft\build
2020-09-15 20:14:10 +00:00
cmake .. ^
-G "Visual Studio 16 2019" ^
-A Win32 ^
-D LIBTYPE:STRING=STATIC ^
2020-09-15 20:14:10 +00:00
-D FORCE_STATIC_VCRT=ON ^
2020-12-10 04:07:59 +00:00
-D ALSOFT_BACKEND_DSOUND=OFF
msbuild -m OpenAL.vcxproj /property:Configuration=Debug
- name: Breakpad cache.
id: cache-breakpad
2020-06-30 08:37:15 +00:00
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/breakpad
key: ${{ runner.OS }}-breakpad-${{ env.CACHE_KEY }}-${{ hashFiles('**/breakpad.diff') }}
- name: Breakpad.
env:
GYP_MSVS_OVERRIDE_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\'
GYP_MSVS_VERSION: 2019
if: steps.cache-breakpad.outputs.cache-hit != 'true'
run: |
git clone %GIT%/telegramdesktop/gyp.git
cd gyp
SET PATH=%PY2%;%cd%;%PATH%
git checkout tdesktop
cd %LibrariesPath%
git clone %GIT%/google/breakpad
cd breakpad
git checkout a1dbcdcb43
git apply ../patches/breakpad.diff
cd src
git clone %GIT%/google/googletest testing
cd client\windows
call gyp --no-circular-check breakpad_client.gyp --format=ninja
cd ..\..
ninja -C out/Debug common crash_generation_client exception_handler
ninja -C out/Release common crash_generation_client exception_handler
cd tools\windows\dump_syms
call gyp dump_syms.gyp
call vcvars32.bat
msbuild -m dump_syms.vcxproj /property:Configuration=Release
- name: Opus cache.
id: cache-opus
2020-06-30 08:37:15 +00:00
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/opus
key: ${{ runner.OS }}-opus-${{ env.CACHE_KEY }}
- name: Opus.
if: steps.cache-opus.outputs.cache-hit != 'true'
run: |
git clone %GIT%/telegramdesktop/opus.git
cd opus
git checkout tdesktop
cd win32\VS2015
msbuild -m opus.sln /property:Configuration=Debug /property:Platform="Win32"
msbuild -m opus.sln /property:Configuration=Release /property:Platform="Win32"
2021-06-01 17:22:10 +00:00
- name: Rnnoise.
run: |
git clone %GIT%/desktop-app/rnnoise.git
mkdir rnnoise\out
cd rnnoise\out
cmake -A Win32 ..
cmake --build . --config Debug
2021-04-27 12:08:41 +00:00
- name: FFmpeg cache.
id: cache-ffmpeg
2020-06-30 08:37:15 +00:00
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/ffmpeg
key: ${{ runner.OS }}-ffmpeg-${{ env.CACHE_KEY }}-2-${{ hashFiles('**/build_ffmpeg_win.sh') }}
- name: FFmpeg.
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: |
choco install --no-progress -y msys2
git clone %GIT%/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
2021-06-01 17:22:10 +00:00
git checkout release/4.4
set CHERE_INVOKING=enabled_from_arguments
set MSYS2_PATH_TYPE=inherit
call c:\tools\msys64\usr\bin\bash --login ../patches/build_ffmpeg_win.sh
rmdir /S /Q .git
2021-07-06 14:10:44 +00:00
- name: Angle cache.
id: cache-angle
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/tg_angle
key: ${{ runner.OS }}-angle-${{ env.CACHE_KEY }}-${{ hashFiles('**/tg_angle-version.json') }}
- name: Angle.
if: steps.cache-angle.outputs.cache-hit != 'true'
run: |
git clone --recursive %GIT%/desktop-app/tg_angle.git
mkdir tg_angle\out\Debug
cd tg_angle\out\Debug
cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=Debug ^
-DTG_ANGLE_SPECIAL_TARGET=win64 ^
-DTG_ANGLE_ZLIB_INCLUDE_PATH=%cd%/../../../zlib ../..
ninja
:: Cleanup.
cd %LibrariesPath%\tg_angle
move out\Debug\tg_angle.lib tg_angle.lib
rmdir /S /Q out
mkdir out\Debug
move tg_angle.lib out\Debug\tg_angle.lib
2020-12-09 13:26:25 +00:00
- name: Qt 5.15.2 cache.
id: cache-qt
2020-06-30 08:37:15 +00:00
uses: actions/cache@v2
with:
2020-08-14 06:45:41 +00:00
path: ${{ env.LibrariesPath }}/Qt-${{ env.QT_VER }}
2020-12-09 13:26:25 +00:00
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_15_2/*') }}
- name: Configure Qt 5.15.2.
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
git clone git://code.qt.io/qt/qt5.git qt_%QT%
cd qt_%QT%
2021-08-11 23:41:31 +00:00
perl init-repository --module-subset=qtbase,qtimageformats,qtsvg
2020-08-14 06:45:41 +00:00
git checkout v%QT_VER%
git submodule update qtbase
git submodule update qtimageformats
2021-08-11 23:41:31 +00:00
git submodule update qtsvg
cd qtbase
2020-06-02 10:14:51 +00:00
for /r %%i in (..\..\patches\qtbase_%QT%\*) do git apply %%i
cd ..
SET SSL=%LibrariesPath%\openssl_%OPENSSL_VER%
2021-07-06 14:10:44 +00:00
SET SSL_LIBS=libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib
SET ANGLE=%LibrariesPath%\tg_angle
SET ANGLE_LIBS=d3d9.lib dxgi.lib dxguid.lib
SET ZLIB=%LibrariesPath%\zlib\contrib\vstudio\vc14\x86
configure ^
2020-08-14 06:45:41 +00:00
-prefix "%LibrariesPath%\Qt-%QT_VER%" ^
-debug ^
-force-debug-info ^
-opensource ^
-confirm-license ^
-static ^
2021-07-06 14:10:44 +00:00
-static-runtime ^
-opengl es2 -no-angle ^
-I "%ANGLE%\include" ^
-D "GL_APICALL=" ^
QMAKE_LIBS_OPENGL_ES2_DEBUG="%ANGLE%\out\Debug\tg_angle.lib %ZLIB%\ZlibStatDebug\zlibstat.lib %ANGLE_LIBS%" ^
QMAKE_LIBS_OPENGL_ES2_RELEASE="%ANGLE%\out\Release\tg_angle.lib %ZLIB%\ZlibStatReleaseWithoutAsm\zlibstat.lib %ANGLE_LIBS%" ^
-egl ^
-D "EGLAPI=" ^
-D "DESKTOP_APP_QT_STATIC_ANGLE=" ^
QMAKE_LIBS_EGL_DEBUG="%ANGLE%\out\Debug\tg_angle.lib %ZLIB%\ZlibStatDebug\zlibstat.lib %ANGLE_LIBS% Gdi32.lib User32.lib" ^
QMAKE_LIBS_EGL_RELEASE="%ANGLE%\out\Release\tg_angle.lib %ZLIB%\ZlibStatReleaseWithoutAsm\zlibstat.lib %ANGLE_LIBS% Gdi32.lib User32.lib" ^
-openssl-linked ^
2021-07-06 14:10:44 +00:00
-I "%SSL%\include" ^
OPENSSL_LIBS_DEBUG="%SSL%\out32.dbg\libssl.lib %SSL%\out32.dbg\%SSL_LIBS%" ^
OPENSSL_LIBS_RELEASE="%SSL%\out32\libssl.lib %SSL%\out32\%SSL_LIBS%" ^
-I "%LibrariesPath%\mozjpeg" ^
LIBJPEG_LIBS_DEBUG="%LibrariesPath%\mozjpeg\Debug\jpeg-static.lib" ^
LIBJPEG_LIBS_RELEASE="%LibrariesPath%\mozjpeg\Release\jpeg-static.lib" ^
-mp ^
-nomake examples ^
-nomake tests ^
2021-07-06 14:10:44 +00:00
-platform win32-msvc
2020-12-09 13:26:25 +00:00
- name: Qt 5.15.2 build.
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
cd qt_%QT%
jom -j%NUMBER_OF_PROCESSORS%
jom -j%NUMBER_OF_PROCESSORS% install
cd ..
rmdir /S /Q qt_%QT%
2020-08-14 06:45:41 +00:00
- name: WebRTC cache.
id: cache-webrtc
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/tg_owt
key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ hashFiles('**/tg_owt-version.json') }}
2020-08-14 06:45:41 +00:00
- name: WebRTC.
if: steps.cache-webrtc.outputs.cache-hit != 'true'
run: |
2020-11-30 19:40:13 +00:00
git clone --recursive %GIT%/desktop-app/tg_owt.git
mkdir tg_owt\out\Debug
cd tg_owt\out\Debug
cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=Debug ^
-DTG_OWT_SPECIAL_TARGET=win ^
2021-06-01 17:22:10 +00:00
-DTG_OWT_BUILD_AUDIO_BACKENDS=OFF ^
2020-10-07 02:21:20 +00:00
-DTG_OWT_LIBJPEG_INCLUDE_PATH=%cd%/../../../mozjpeg ^
-DTG_OWT_OPENSSL_INCLUDE_PATH=%cd%/../../../openssl_%OPENSSL_VER%/include ^
-DTG_OWT_OPUS_INCLUDE_PATH=%cd%/../../../opus/include ^
-DTG_OWT_FFMPEG_INCLUDE_PATH=%cd%/../../../ffmpeg ^
../..
ninja
:: Cleanup.
cd %LibrariesPath%\tg_owt
move out\Debug\tg_owt.lib tg_owt.lib
rmdir /S /Q out
mkdir out\Debug
move tg_owt.lib out\Debug\tg_owt.lib
2020-08-14 06:45:41 +00:00
- name: Read defines.
shell: bash
run: |
DEFINE=""
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
2020-10-25 01:46:27 +00:00
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
else
2020-10-25 01:46:27 +00:00
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
fi
2020-10-25 01:46:27 +00:00
echo "TDESKTOP_BUILD_DEFINE=$DEFINE" >> $GITHUB_ENV
2021-06-01 17:22:10 +00:00
- name: Free up some disk space.
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
2021-06-01 17:22:10 +00:00
run: del /S *.pdb
- name: Telegram Desktop build.
if: env.ONLY_CACHE == 'false'
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
run: |
cd %REPO_NAME%\Telegram
call configure.bat ^
-D TDESKTOP_API_TEST=ON ^
-D DESKTOP_APP_USE_PACKAGED=OFF ^
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^
2021-03-17 09:45:19 +00:00
-D DESKTOP_APP_NO_PDB=ON ^
%TDESKTOP_BUILD_DEFINE% ^
-DCMAKE_SYSTEM_VERSION=%SDK%
call vcvars32.bat
cd ..\out
msbuild -m Telegram.sln /nologo /p:Configuration=Debug,Platform=Win32
- name: Move artifact.
if: env.UPLOAD_ARTIFACT == 'true'
2021-08-11 02:52:44 +00:00
working-directory: ${{ github.workspace }}
run: |
cd %REPO_NAME%\out\Debug
mkdir artifact
move Telegram.exe artifact/
- uses: actions/upload-artifact@master
name: Upload artifact.
if: env.UPLOAD_ARTIFACT == 'true'
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.REPO_NAME }}\out\Debug\artifact\