Build - Win #36
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
# 2024-03-02 14:40 | |
name: "Build - Win" | |
on: | |
# push: | |
# branches: [ 'develop', 'release/2.7.x' ] | |
# pull_request: | |
# # The branches below must be a subset of the branches above | |
# branches: [ 'develop' ] | |
# schedule: | |
# - cron: '5 16 * * 3' | |
workflow_dispatch: | |
inputs: | |
archive-build: | |
description: archive-build | |
type: boolean | |
default: false | |
required: true | |
archive-NoVCPKG: | |
description: archive-NoVCPKG | |
type: boolean | |
default: false | |
required: true | |
archive-all: | |
description: archive-all | |
type: boolean | |
default: false | |
required: true | |
msvc-17-8: | |
description: MSVC 17.8 | |
type: boolean | |
default: false | |
required: true | |
build_tool: | |
description: build tool | |
type: choice | |
options: | |
- 'msbuild' | |
- 'cmake' | |
- 'release-tool' | |
- 'MSYS' | |
default: msbuild | |
required: true | |
SED_STUFF: | |
description: SED_STUFF | |
type: boolean | |
default: true | |
required: true | |
SED_STUFF_PARAMS: | |
description: SED_STUFF_PARAMS | |
default: "build.py" | |
required: true | |
DEBUG_MODE: | |
description: DEBUG_MODE | |
default: "N" | |
required: true | |
env: | |
TAG_NAME: 'keepassxc' | |
TAG_NAME_BUILD: 'keepassxc-build' | |
TAG_NAME_ALL: 'keepassxc-ALL' | |
PROG_NAME: 'keepassxc' | |
PROG_VERSION: '1.1.1' | |
DRAFT: true | |
ARCH: 'amd64' | |
GUI: 'win' | |
VCPKG_COMMIT_ID: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50" | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 360 | |
permissions: | |
actions: read | |
contents: write | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ 'windows-2022' ] | |
#os: [ 'windows-2019', 'windows-2022' ] | |
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | |
# Use only 'java' to analyze code written in Java, Kotlin or both | |
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both | |
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | |
steps: | |
- name: Checkout repository | |
uses: deep-soft/checkout@v4 | |
# - name: Set the version string for the program | |
# continue-on-error: true | |
# working-directory: ${{github.workspace}}/build | |
# shell: bash | |
# run: | | |
# VERSION=$(grep KEEPASSXC_VERSION src/config-keepassx.h | awk '{print $3}' | tr -d '"'); | |
# echo "VERSION=$VERSION"; | |
# echo "PROG_VERSION=$VERSION" >> $GITHUB_ENV; | |
- name: get program name, version | |
shell: bash | |
run: | | |
PROG_NAME=$(grep "project(" CMakeLists.txt | awk -F'(' '{print $2}' | awk -F')' '{print $1}') | |
VER_MAJOR=$(grep "(KEEPASSXC_VERSION_MAJOR" CMakeLists.txt | awk -F'"' '{print $2}') | |
VER_MINOR=$(grep "(KEEPASSXC_VERSION_MINOR" CMakeLists.txt | awk -F'"' '{print $2}') | |
VER_PATCH=$(grep "(KEEPASSXC_VERSION_PATCH" CMakeLists.txt | awk -F'"' '{print $2}') | |
echo "PROG_NAME=$PROG_NAME" >> $GITHUB_ENV | |
echo "PROG_VERSION=$VER_MAJOR.$VER_MINOR.$VER_PATCH" >> $GITHUB_ENV | |
- name: print program name, version | |
shell: bash | |
run: | | |
echo "PROG_NAME=${{ env.PROG_NAME }}" | |
echo "PROG_VERSION=${{ env.PROG_VERSION }}" | |
# - name: Setup cache | |
# uses: deep-soft/cache@v4 | |
# with: | |
# path: build | |
# key: ccache-${{ matrix.job.os }} | |
# restore-keys: | | |
# ccache-${{ matrix.job.os }}- | |
- name: Install tools | |
continue-on-error: true | |
# choco install ruby | |
run: | | |
gem install asciidoctor | |
# - name: code fix | |
# continue-on-error: true | |
# shell: bash | |
# run: | | |
# sed -ibak "s!#include \"QuickUnlockInterface.h\";!#include \"QuickUnlockInterface.h\"!" "src/quickunlock/WindowsHello.h" | |
# grep "QuickUnlockInterface" "src/quickunlock/WindowsHello.h" | |
# | |
# #sed -ibak "s!#include <Windows.h>!#include <Windows.h>\n#include <winuser.h>!" "src/gui/osutils/winutils/WinUtils.cpp" | |
# #grep "winuser.h" "src/gui/osutils/winutils/WinUtils.cpp" | |
# | |
# sed -ibak "s!#include <Windows.h>!#include <Windows.h>\n#define WDA_EXCLUDEFROMCAPTURE 0x00000011!" "src/gui/osutils/winutils/WinUtils.cpp" | |
# grep "WDA_EXCLUDEFROMCAPTURE" "src/gui/osutils/winutils/WinUtils.cpp" | |
- name: sed-stuff | |
if: ${{ inputs.SED_STUFF }} | |
continue-on-error: true | |
shell: bash | |
env: | |
DEBUG_MODE_1: ${{ inputs.DEBUG_MODE }} | |
DEBUG_MODE_2: ${{ inputs.DEBUG_MODE }} | |
run: | | |
bash bins/sed-stuff.sh "_" "${{ inputs.SED_STUFF_PARAMS }}" | |
- name: Set MSVC - VS 17.8 sdk 10.0.22000.0 toolset 14.29 | |
if: ${{ inputs.build_tool != 'MSYS' && inputs.msvc-17-8 }} | |
#sdk: 10.0.22621.0 | |
#toolset: 14.38 | |
uses: deep-soft/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
sdk: 10.0.22000.0 | |
toolset: 14.29 | |
vsversion: 17.8 | |
- name: Set MSVC - latest | |
if: ${{ inputs.build_tool != 'MSYS' && !inputs.msvc-17-8 }} | |
#sdk: 10.0.22621.0 | |
#toolset: 14.38 | |
uses: deep-soft/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
#sdk: 10.0.22000.0 | |
#toolset: 14.29 | |
#vsversion: 17.8 | |
- name: Install gcc x64 | |
if: inputs.build_tool == 'MSYS' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
install: make gcc mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-toolchain | |
- name: Setup vcpkg with Github Actions binary cache | |
# if: inputs.build_tool != 'MSYS' | |
continue-on-error: true | |
uses: deep-soft/run-vcpkg@v11 | |
with: | |
#VCPKG_BINARY_SOURCES: | |
#ACTIONS_CACHE_URL: | |
#ACTIONS_RUNTIME_TOKEN: | |
doNotCache: false | |
#vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} | |
#vcpkgDirectory: C:\vcpkg | |
#vcpkgGitURL: | |
#doNotUpdateVcpkg: | |
vcpkgConfigurationJsonGlob: vcpkg-configuration.json | |
vcpkgJsonGlob: vcpkg.json | |
#VCPKG_CONFIGURATION_JSON_IGNORE_PATTERNS: | |
runVcpkgInstall: false | |
#VCPKG_DEFAULT_TRIPLET | |
# - name: Install vcpkg dependencies | |
# if: inputs.build_tool != 'MSYS' | |
# continue-on-error: true | |
# shell: bash | |
# run: | | |
# "$VCPKG_ROOT/vcpkg" install argon2 botan minizip qt5 qt5-svg qt5-tools qt5-imageformats qt5-translations readline zlib libqrencode --triplet=x64-windows | |
# $VCPKG_ROOT/vcpkg install openvpn3 | |
# $VCPKG_ROOT/vcpkg-ports install pkcs11-helper | |
# $VCPKG_ROOT/vcpkg --overlay-ports=<openvpn>\contrib\vcpkg-ports install pkcs11-helper | |
# $VCPKG_ROOT/vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static | |
- name: cmake - configure | |
if: inputs.build_tool != 'MSYS' | |
continue-on-error: true | |
shell: bash | |
run: | | |
mkdir build || true; | |
cd build || true; | |
cmake .. \ | |
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT"/scripts/buildsystems/vcpkg.cmake \ | |
-DWITH_XC_AUTOTYPE=ON \ | |
-DWITH_XC_BROWSER=ON \ | |
-DWITH_XC_SSHAGENT=ON \ | |
-DWITH_XC_KEESHARE=ON \ | |
-DWITH_XC_FDOSECRETS=OFF \ | |
-DWITH_XC_NETWORKING=OFF \ | |
-DWITH_XC_YUBIKEY=OFF \ | |
-DKEEPASSXC_BUILD_TYPE=Release | |
# cmake --build .. --config Release; | |
# cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DWITH_XC_ALL=ON -DWITH_XC_YUBIKEY=OFF -DKEEPASSXC_BUILD_TYPE=Release .. | |
- name: build - MSYS - cmake | |
if: inputs.build_tool == 'MSYS' | |
continue-on-error: true | |
shell: bash | |
run: | | |
mkdir build || true; | |
cd build || true; | |
cmake .. -G "MSYS Makefiles" \ | |
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \ | |
-DWITH_XC_AUTOTYPE=ON \ | |
-DWITH_XC_BROWSER=ON \ | |
-DWITH_XC_SSHAGENT=ON \ | |
-DWITH_XC_KEESHARE=ON \ | |
-DWITH_XC_FDOSECRETS=OFF \ | |
-DWITH_XC_NETWORKING=OFF \ | |
-DWITH_XC_YUBIKEY=OFF \ | |
-DCMAKE_BUILD_TYPE=Release | |
- name: Build - msbuild - solution | |
if: inputs.build_tool == 'msbuild' | |
continue-on-error: true | |
working-directory: ${{github.workspace}}/build | |
run: | | |
msbuild -m /property:Configuration=Release /property:Platform=x64 KeePassXC.sln | |
# msbuild -m /property:Configuration=Release /property:Platform=x64 PACKAGE.vcxproj | |
# msbuild -m /property:Configuration=Release /property:Platform=x64 KeePassXC.sln | |
# msbuild -m /property:Configuration=${{ inputs.build_config }} /property:Platform=${{ inputs.platform_sln }} KeePassXC.sln | |
- name: Build - msbuild - install | |
if: inputs.build_tool == 'msbuild' | |
continue-on-error: true | |
working-directory: ${{github.workspace}}/build | |
run: | | |
msbuild -m /property:Configuration=Release /property:Platform=x64 INSTALL.vcxproj | |
- name: Build - msbuild - package | |
if: inputs.build_tool == 'msbuild' | |
continue-on-error: true | |
working-directory: ${{github.workspace}}/build | |
run: | | |
msbuild -m /property:Configuration=Release /property:Platform=x64 PACKAGE.vcxproj | |
- name: build - cmake | |
if: inputs.build_tool == 'cmake' | |
continue-on-error: true | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: | | |
cmake --build . --config Release; | |
- name: build - release-tool.ps1 | |
if: inputs.build_tool == 'release-tool' | |
continue-on-error: true | |
# shell: powershell | |
run: ./release-tool.ps1 -build -version ${{ env.PROG_VERSION }} -Vcpkg ${{ env.VCPKG_ROOT }} | |
- name: build - MSYS - | |
if: inputs.build_tool == 'MSYS' | |
continue-on-error: true | |
shell: msys2 {0} | |
working-directory: ${{github.workspace}}/build | |
run: | | |
make CLANG=1 -j"$(nproc)" package | |
- name: Prepare to sign | |
continue-on-error: true | |
#xcopy /E /F /Y ..\build\_CPack_Packages\win64\ZIP\KeePassXC-2.8.0-Win64\* Output\* /EXCLUDE:keepass-prep.exclude | |
shell: cmd | |
run: | | |
echo .exp > keepass-prep.exclude | |
echo .lib >> keepass-prep.exclude | |
echo \translations\ >> keepass-prep.exclude | |
mkdir Output | |
xcopy /E /F /Y .\build\src\proxy\Release\* Output\* /EXCLUDE:keepass-prep.exclude | |
xcopy /E /F /Y .\build\src\cli\Release\* Output\* /EXCLUDE:keepass-prep.exclude | |
xcopy /E /F /Y .\build\src\autotype\windows\Release\* Output\* /EXCLUDE:keepass-prep.exclude | |
xcopy /E /F /Y .\build\src\Release\* Output\* /EXCLUDE:keepass-prep.exclude | |
xcopy /E /F /Y .\build\_CPack_Packages\win64\ZIP\KeePassXC-${{ env.PROG_VERSION }}-Win64\* Output\* /EXCLUDE:keepass-prep.exclude | |
- name: Sign files | |
uses: deep-soft/code-sign-action@v9 | |
with: | |
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' | |
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' | |
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' | |
# certificatename: '${{ secrets.CERTNAME }}' | |
folder: './Output/' | |
recursive: true | |
- name: Archive Release | |
continue-on-error: true | |
uses: deep-soft/zip-release@v2 | |
with: | |
type: 'zip' | |
filename: '${{ env.PROG_NAME }}-${{ env.PROG_VERSION }}-${{ matrix.os }}.zip' | |
directory: './Output' | |
env_variable: 'ZIP_ARCHIVE_RELEASE' | |
# archive name is ${{ env.ZIP_RELEASE_ARCHIVE }} | |
- name: Publish Release | |
continue-on-error: true | |
uses: deep-soft/action-gh-release@v2.1 | |
with: | |
draft: ${{ env.DRAFT }} | |
tag_name: ${{ env.PROG_NAME }}-${{ env.PROG_VERSION }} | |
files: | | |
${{ env.ZIP_ARCHIVE_RELEASE }} | |
- name: Publish Release package | |
continue-on-error: true | |
uses: deep-soft/action-gh-release@v2.1 | |
with: | |
draft: ${{ env.DRAFT }} | |
tag_name: ${{ env.TAG_NAME_BUILD }} | |
files: | | |
./build/*.zip | |
./build/*.msi | |
- name: Archive Release | |
if: ${{ inputs.archive-build }} | |
continue-on-error: true | |
uses: deep-soft/zip-release@v2 | |
with: | |
type: '7z' | |
filename: '${{ env.PROG_NAME }}-${{ env.PROG_VERSION }}-${{ matrix.os }}-build.zip' | |
directory: './build' | |
volume_size: 2g | |
env_variable: 'ZIP_ARCHIVE_BUILD' | |
# archive name is ${{ env.ZIP_RELEASE_ARCHIVE }} | |
- name: Publish Release | |
if: ${{ inputs.archive-build }} | |
continue-on-error: true | |
uses: deep-soft/action-gh-release@v2.1 | |
with: | |
draft: ${{ env.DRAFT }} | |
tag_name: ${{ env.TAG_NAME_BUILD }} | |
files: | | |
${{ env.ZIP_ARCHIVE_BUILD }} | |
- name: Archive Release - NoVCPKG | |
if: ${{ inputs.archive-NoVCPKG }} | |
continue-on-error: true | |
uses: deep-soft/zip-release@v2 | |
with: | |
type: '7z' | |
filename: '${{ env.PROG_NAME }}-${{ env.PROG_VERSION }}-${{ matrix.os }}-NoVCPKG.zip' | |
directory: './' | |
exclusions: './vcpkg' | |
volume_size: 2g | |
env_variable: 'ZIP_ARCHIVE_NoVCPKG' | |
# archive name is ${{ env.ZIP_RELEASE_ARCHIVE }} | |
- name: Publish Release - NoVCPKG | |
if: ${{ inputs.archive-NoVCPKG }} | |
continue-on-error: true | |
uses: deep-soft/action-gh-release@v2.1 | |
with: | |
draft: ${{ env.DRAFT }} | |
tag_name: ${{ env.TAG_NAME_ALL }} | |
files: | | |
${{ env.ZIP_ARCHIVE_NoVCPKG }} | |
- name: Archive Release - ALL | |
if: ${{ inputs.archive-all }} | |
continue-on-error: true | |
uses: deep-soft/zip-release@v2 | |
with: | |
type: '7z' | |
filename: '${{ env.PROG_NAME }}-${{ env.PROG_VERSION }}-${{ matrix.os }}-ALL.zip' | |
directory: './' | |
volume_size: 2g | |
env_variable: 'ZIP_ARCHIVE_ALL' | |
# archive name is ${{ env.ZIP_RELEASE_ARCHIVE }} | |
- name: Publish Release - ALL | |
if: ${{ inputs.archive-all }} | |
continue-on-error: true | |
uses: deep-soft/action-gh-release@v2.1 | |
with: | |
draft: ${{ env.DRAFT }} | |
tag_name: ${{ env.TAG_NAME_ALL }} | |
files: | | |
${{ env.ZIP_ARCHIVE_ALL }} |