forked from keepassxreboot/keepassxc
-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (188 loc) · 10.1 KB
/
bld-test-upload.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File: .github/workflows/bld-test-upload.yml
# Copyright: 2024, Owner of blessio.com
# License: MIT
############################################
# Used the starter here:
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
# BUILDS KeepasXC
name: BLD AND TEST MatrixBased-WIN64-UBUNTU-MacOS
on:
push:
branches: [ "develop", "devbleo3", bleo8, bleo5_01, bleo5_01.1 ]
pull_request:
branches: [ "devbleo" , bleo5_01 ]
jobs:
build:
#needs: [winprep]
runs-on: ${{ matrix.config.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
build_type: [RelWithDebInfo,Debug] #Release with no debug info is useless I believe
config:
- os: windows-2022 # , ubuntu-latest] #[windows-latest] # [ubuntu-latest, windows-latest]
vcpkg_triplet: x64-windows
github-binarycache: true
- os: ubuntu-22.04 # , ubuntu-latest] #[windows-latest] # [ubuntu-latest, windows-latest]
vcpkg_triplet: x64-linux
github-binarycache: true
- os: macos-latest
vcpkg_triplet: x64-osx-dynamic-release
github-binarycache: true
steps:
###################################
- name: Generate UUID
id: generate-uuid
uses: filipstefansson/uuid-action@v1
- name: Set reusable strings and Environment for actions
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-sub-dir=build" >> "$GITHUB_OUTPUT"
echo "build-root-vcpkg-dir=_vpkg" >> "$GITHUB_OUTPUT"
echo "build-winsdk=10.0.26100" >> "$GITHUB_OUTPUT"
echo "FORCE_JAVASCRIPT_ACTIONS_TO_NODE20=true" >> "$GITHUB_OUTPUT"
echo "bld-var-str=${{ matrix.build_type }}-BLD_ON_${{ matrix.config.os }}_${{ matrix.config.vcpkg_triplet }}_${{ steps.generate-uuid.outputs.uuid }}" >> "$GITHUB_OUTPUT"
echo "TRIPLET IS ${{ matrix.config.vcpkg_triplet }}"
echo "Running on ${{ matrix.config.os }}"
- name: Windows Only // Install Winget so that e can use it to install SDK as needed
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
uses: Cyberboss/install-winget@v1
- name: Windows Only // Set Up windows SDK and Ruby and the needed gem of asciidoctor
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
winget install --source winget --exact --id Microsoft.WindowsSDK.${{ steps.strings.outputs.build-winsdk }} --silent
winget install RubyInstallerTeam.Ruby.3.2 --accept-package-agreements --accept-source-agreements
gem install asciidoctor
- name: Windows Only // Set environment variable VCPKG_ROOT
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
$env:VCPKG_ROOT = "$env:VCPKG_INSTALLATION_ROOT"
echo "VCPKG_ROOT=$env:VCPKG_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: LINUX Only // Prepare Linux packages that are needed
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }}
run: >
sudo apt update -y &&
sudo apt upgrade -y &&
sudo apt install -y build-essential cmake g++ asciidoctor &&
sudo apt install -y qtbase5-dev qtbase5-private-dev qttools5-dev qttools5-dev-tools
libqt5svg5-dev libargon2-dev libminizip-dev libbotan-2-dev libqrencode-dev
libkeyutils-dev zlib1g-dev libreadline-dev libpcsclite-dev libusb-1.0-0-dev
libxi-dev libxtst-dev libqt5x11extras5-dev
- name: MACOS Only // Prepare Linux packages that are needed
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: |
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install cmake asciidoctor
brew install pkg-config vcpkg
- name: get from Git
uses: actions/checkout@v4
- name: Windows AND MacOS // VCPKG install build
id: vcpkg
if: ${{ startsWith( matrix.config.os , 'windows' ) }} || ${{ startsWith( matrix.config.os , 'macos' ) }}
uses: blessio/[email protected]
with:
manifest-dir: ${{ github.workspace }} # Set to directory containing vcpkg.json
triplet: ${{ matrix.config.vcpkg_triplet }} # x64-windows-release
token: ${{ github.token }}
github-binarycache: true
vcpkg-subdir: ${{ steps.strings.outputs.build-root-vcpkg-dir}}
cache-key: "kpxco5-${{ matrix.config.vcpkg_triplet }}"
fetch-depth: "0"
- name: Print intermediate environment results
shell: bash
run: |
echo " *** RECOMENDED CMAKE CONFIG is ${{ steps.vcpkg.outputs.vcpkg-cmake-config }}"
echo " *** HASH IS ${{ steps.vcpkg.outputs.vcpkg-cache-hash }}"
- name: Windows ONLY // Configure CMake
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: >
mkdir ${{ steps.strings.outputs.build-sub-dir }} &&
cd ${{ steps.strings.outputs.build-sub-dir }} &&
cmake -DWITH_XC_ALL=ON
-DCMAKE_SYSTEM_VERSION=${{ steps.strings.outputs.build-winsdk }}
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\${{ steps.strings.outputs.build-root-vcpkg-dir}}\scripts\buildsystems\vcpkg.cmake
-DVCPKG_TARGET_TRIPLET= ${{ matrix.config.vcpkg_triplet }}
-DCMAKE_BUILD_TYPE= ${{ matrix.build_type }}
-DWITH_GUI_TESTS=ON
..
- name: LINUX ONLY // Configure CMake
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }}
run: >
mkdir ${{ steps.strings.outputs.build-sub-dir }} &&
cd ${{ steps.strings.outputs.build-sub-dir }} &&
cmake -DWITH_XC_ALL=ON
-DWITH_GUI_TESTS=ON
..
- name: Windows Check DiskSpace
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: >
Get-PSDrive -PSProvider FileSystem | Select-Object Name, @{Name="Used (GB)";Expression={[math]::round($_.Used/1GB,2)}},
@{Name="Free (GB)";Expression={[math]::round($_.Free/1GB,2)}}
#- name: Print all environement Variables
# run: >
# Get-ChildItem Env: | Sort-Object Name
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
run: |
cmake --build . --config ${{ matrix.build_type }}
# Prep for the tests
- name: Windows Only // ADD paths to some specual DLLs needed for the testing
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
$env:PATH="$env:PATH;${{ github.workspace }}\${{ steps.strings.outputs.build-sub-dir }}\src\autotype\test\${{ matrix.build_type }}"
echo "PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Linux // ADD paths to some specual DLLs needed for the testing
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }}
run: |
echo "export PATH=$PATH:${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/src/autotype/test/${{ matrix.build_type }}" >> ~/.bashrc
source ~/.bashrc
- name: PRINT Environment Variable
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
Get-ChildItem Env: | Sort-Object Name
cd "${{ github.workspace }}\${{ steps.strings.outputs.build-sub-dir }}\src\autotype\test\${{ matrix.build_type }}"
ls
- name: Test and Install
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
shell: bash
continue-on-error: true
run: |
ctest --build-config ${{ matrix.build_type }}
ctest --build-config ${{ matrix.build_type }} --rerun-failed --output-on-failure
- name: Install
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
shell: bash
continue-on-error: true
run: >
cmake --install ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
--config ${{ matrix.build_type }} --prefix ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/_install -v
- name: WINDOWS ONLY // Upload build Executables
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
uses: actions/upload-artifact@v3
with:
name: build-win-executables- ${{ steps.strings.outputs.bld-var-str }}
path: |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/src/${{ matrix.build_type }}
- name: NON-WINDOWS // Upload build Executables
if: ${{ ! startsWith( matrix.config.os , 'windows' ) }}
uses: actions/upload-artifact@v3
with:
name: build-non-win-executables- ${{ steps.strings.outputs.bld-var-str }}
path: |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/_install
- name: Upload build Test Result Logs
uses: actions/upload-artifact@v3
with:
name: Test-Logs ${{ steps.strings.outputs.bld-var-str }}
path: |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/Testing/Temporary