-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try creating a github action for windows build
- Loading branch information
Showing
1 changed file
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: Build Windows | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '**.md' | ||
tags: | ||
- '*' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup devcmd | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha | ||
- name: Set variables for vcpkg | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
core.exportVariable('ACTIONS_CACHE_URL', (process.env.ACTIONS_CACHE_URL || '')); | ||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', (process.env.ACTIONS_RUNTIME_TOKEN || '')); | ||
- name: Install Qt | ||
uses: jurplel/install-qt-action@v3 | ||
with: | ||
version: 6.6.1 | ||
modules: qt5compat qtmultimedia | ||
|
||
- name: Install dependencies with vcpkg | ||
run: | | ||
# create our own triplet | ||
New-Item ` | ||
-Force ` | ||
-ItemType File ` | ||
-Path "${{ env.vcpkg_path }}/triplets_overlay/x64-windows-release.cmake" | ||
Add-Content ` | ||
-Path "${{ env.vcpkg_path }}/triplets_overlay/x64-windows-release.cmake" ` | ||
-Value @("set(VCPKG_TARGET_ARCHITECTURE x64)", | ||
"set(VCPKG_LIBRARY_LINKAGE dynamic)", | ||
"set(VCPKG_CRT_LINKAGE dynamic)", | ||
"set(VCPKG_BUILD_TYPE release)") | ||
c:/vcpkg/vcpkg.exe install ` | ||
--binarysource="clear;x-gha,readwrite" ` | ||
--clean-after-build ` | ||
--overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay" ` | ||
gettext:x64-windows-release ` | ||
openssl:x64-windows-release ` | ||
zlib:x64-windows-release | ||
- name: Patch Perl for MSVC support | ||
run: | | ||
# Strawberry perl doesn't support MSVC, but we force the support. | ||
cd '${{github.workspace}}' | ||
type .appveyor.perl >> c:\Strawberry\perl\lib\core\config.h" | ||
# missing: | ||
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md | ||
# enchant 2 and dictionaries | ||
# perl (check prenistalled) | ||
# python (check preinstalled) | ||
# nsis | ||
|
||
|
||
#-GNMake Makefiles | ||
#-DCMAKE_VERBOSE_MAKEFILE=1 | ||
#-DPERL_EXECUTABLE=c:/Strawberry/perl/bin/perl.exe | ||
#-DEnchant_FOUND=1 | ||
#-DEnchant_INCLUDE_DIRS=c:/enchant-headers;$env:mingw_root/include/enchant-2;$env:mingw_root/include/glib-2.0 | ||
#-DEnchant_LDFLAGS=$env:mingw_root/lib/libenchant-2.dll.a | ||
|
||
- name: Configure CMake | ||
run: | | ||
cd '${{github.workspace}}' | ||
mkdir build | ||
cd build | ||
cmake .. ` | ||
-DCMAKE_TOOLCHAIN_FILE="c:/vcpkg/scripts/buildsystems/vcpkg.cmake" ` | ||
-DVCPKG_TARGET_TRIPLET=x64-windows-release ` | ||
-DCMAKE_BUILD_TYPE=Release ` | ||
-DWANT_KDE=NO ` | ||
-DWANT_OPENSSL=YES ` | ||
-DWANT_PERL=YES ` | ||
-DWANT_PHONON=NO ` | ||
-DWANT_PYTHON=YES ` | ||
-DWANT_QTWEBENGINE=NO | ||
- name: Build | ||
run: | | ||
cd '${{github.workspace}}' | ||
cd build | ||
cmake --build . | ||
- name: Install | ||
run: | | ||
cd '${{github.workspace}}' | ||
cd build | ||
cmake --install . | ||
- name: Deployt Qt | ||
run: | | ||
cd '${{github.workspace}}' | ||
cd build | ||
windeployqt "--dir" "release/qt-plugins" "--libdir" "release/" "release/kvirc.exe" "release/modules/"; if (!$?) { exit 1 } | ||
# missing: libenchant, perl, python | ||
- name: Deploy other dlls | ||
run: | | ||
cd '${{github.workspace}}' | ||
cd build | ||
cp "c:\vcpkg\installed\x64-windows-release\bin\zlib1.dll" release; if (!$?) { exit 1 } | ||
cp "c:\vcpkg\installed\x64-windows-release\bin\libcrypto*.dll" release; if (!$?) { exit 1 } | ||
cp "c:\vcpkg\installed\x64-windows-release\bin\libssl*.dll" release; if (!$?) { exit 1 } | ||
- name: Detect version | ||
shell: bash | ||
run: | | ||
cd '${{github.workspace}}' | ||
kvi_version=$(grep -i "^set(VERSION_RELEASE .*)$" CMakeLists.txt | egrep -o '[0-9\.]' | tr -d '\n') | ||
git_desc=$(git describe --always) | ||
echo "exe_name=KVIrc-$kvi_version-dev-$(date +%F)-git-$git_desc" >> "$GITHUB_ENV" | ||
- name: Create setup package | ||
run: | | ||
cd '${{github.workspace}}' | ||
cd build | ||
c:\Program Files (x86)\NSIS\makensis.exe" KVIrc.nsi | ||
#- name: Publish artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: ${{ env.exe_name }}.exe | ||
# path: ${{ env.exe_name }}.exe |