-
Notifications
You must be signed in to change notification settings - Fork 7
214 lines (182 loc) · 7.51 KB
/
windows-build.yaml
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
##############################################################################
# Copyright 2022-2024 Leon Lynch
#
# This file is licensed under the terms of the LGPL v2.1 license.
# See LICENSE file.
##############################################################################
name: Windows build
on: [push]
env:
TR31_VERSION: 0.6.1
jobs:
build-windows-msys2-debug:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { sys: mingw64, env: x86_64, build_type: "Release", lib_type: "static", shared_libs: "NO", deps: "none", fetch_deps: NO, build_dukpt_ui: NO }
- { sys: mingw64, env: x86_64, build_type: "Debug", lib_type: "dll", shared_libs: "YES", deps: "tr31/qt6", fetch_deps: NO, build_dukpt_ui: YES }
- { sys: mingw64, env: x86_64, build_type: "Release", lib_type: "static", shared_libs: "NO", deps: "tr31/qt5", fetch_deps: YES, build_dukpt_ui: YES }
- { sys: ucrt64, env: ucrt-x86_64, build_type: "Debug", lib_type: "static", shared_libs: "NO", deps: "tr31/qt5", fetch_deps: NO, build_dukpt_ui: YES }
- { sys: ucrt64, env: ucrt-x86_64, build_type: "Release", lib_type: "dll", shared_libs: "YES", deps: "tr31/qt6", fetch_deps: YES, build_dukpt_ui: YES }
# NOTE: Only test Qt6 for clang64 because Qt5's windeployqt does not support clang64
- { sys: clang64, env: clang-x86_64, build_type: "Debug", lib_type: "dll", shared_libs: "YES", deps: "tr31/qt6", fetch_deps: NO, build_dukpt_ui: YES }
- { sys: clang64, env: clang-x86_64, build_type: "Release", lib_type: "static", shared_libs: "NO", deps: "tr31/qt6", fetch_deps: YES, build_dukpt_ui: YES }
name: Windows MSYS2 ${{matrix.sys}} build (${{ matrix.lib_type }}/${{ matrix.build_type }}/${{ matrix.deps }})
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSYS2 ${{matrix.sys}}
uses: msys2/setup-msys2@v2
with:
release: false
msystem: ${{matrix.sys}}
install: >-
base-devel
git
mingw-w64-${{matrix.env}}-toolchain
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-github-cli
- name: Install MbedTLS
if: ${{ matrix.fetch_deps == 'NO' }}
run: |
pacman --noconfirm -S --needed mingw-w64-${{matrix.env}}-mbedtls
echo "CMAKE_REQUIRE_FIND_PACKAGE_MbedTLS=YES" >> $GITHUB_ENV
- name: Install Qt5
if: contains(matrix.deps, 'qt5')
run: |
pacman --noconfirm -S --needed mingw-w64-${{matrix.env}}-qt5-base mingw-w64-${{matrix.env}}-qt5-tools
- name: Install Qt6
if: contains(matrix.deps, 'qt6')
run: |
pacman --noconfirm -S --needed mingw-w64-${{matrix.env}}-qt6-base mingw-w64-${{matrix.env}}-qt6-tools
- name: Build TR-31 dependency
if: contains(matrix.deps, 'tr31')
run: |
gh release download --repo openemv/tr31 ${{ env.TR31_VERSION }}
tar xvfz tr31-${{ env.TR31_VERSION }}-src.tar.gz
cd tr31-${{ env.TR31_VERSION }}
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} -DFETCH_MBEDTLS=${{ matrix.fetch_deps }} -DCMAKE_REQUIRE_FIND_PACKAGE_MbedTLS=${{ env.CMAKE_REQUIRE_FIND_PACKAGE_MbedTLS }} -DBUILD_TR31_TOOL=NO
cmake --build build
echo "TR31_DIR=$(pwd)/build/cmake/" >> $GITHUB_ENV
echo "CMAKE_REQUIRE_FIND_PACKAGE_tr31=YES" >> $GITHUB_ENV
cd ..
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# MSYS2 Git assumes CRLF by default
- name: Configure Git
run: |
git config --global core.autocrlf true
git describe --always --dirty
- name: Configure CMake
run: |
cmake -G Ninja -B build \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
-DFETCH_MBEDTLS=${{ matrix.fetch_deps }} \
-DCMAKE_REQUIRE_FIND_PACKAGE_MbedTLS=${{ env.CMAKE_REQUIRE_FIND_PACKAGE_MbedTLS }} \
-DFETCH_ARGP=YES \
-Dtr31_DIR=${{ env.TR31_DIR }} \
-DCMAKE_REQUIRE_FIND_PACKAGE_tr31=${{ env.CMAKE_REQUIRE_FIND_PACKAGE_tr31 }} \
-DCMAKE_DISABLE_FIND_PACKAGE_Qt5=${{ !contains(matrix.deps, 'qt5') && 'YES' || 'NO' }} \
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=${{ !contains(matrix.deps, 'qt6') && 'YES' || 'NO' }} \
-DBUILD_DUKPT_UI=${{ matrix.build_dukpt_ui }}
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
build-windows-msys2-release:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { sys: mingw64, env: x86_64, build_type: "RelWithDebInfo" }
name: Windows MSYS2 ${{matrix.sys}} build (release)
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup MSYS2 ${{matrix.sys}}
uses: msys2/setup-msys2@v2
with:
release: false
msystem: ${{matrix.sys}}
install: >-
base-devel
git
mingw-w64-${{matrix.env}}-toolchain
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-github-cli
mingw-w64-${{matrix.env}}-nsis
- name: Install Qt6
uses: jurplel/install-qt-action@v3
with:
version: 6.5.*
host: windows
target: desktop
arch: win64_mingw
archives: qtbase qttools MinGW
cache: true
- name: Build TR-31 dependency
run: |
gh release download --repo openemv/tr31 ${{ env.TR31_VERSION }}
tar xvfz tr31-${{ env.TR31_VERSION }}-src.tar.gz
cd tr31-${{ env.TR31_VERSION }}
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DBUILD_SHARED_LIBS=YES -DFETCH_MBEDTLS=YES -DBUILD_TR31_TOOL=NO
cmake --build build
echo "TR31_DIR=$(pwd)/build/cmake/" >> $GITHUB_ENV
cd ..
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# MSYS2 Git assumes CRLF by default
- name: Configure Git
run: |
git config --global core.autocrlf true
echo "GIT_DESCRIBE=$(git describe --always --dirty)" >> $GITHUB_ENV
- name: Configure CMake
run: |
cmake -G Ninja -B build \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DBUILD_SHARED_LIBS=YES \
-DFETCH_MBEDTLS=YES \
-DFETCH_ARGP=YES \
-Dtr31_DIR=${{ env.TR31_DIR }} \
-DBUILD_DUKPT_UI=YES
# CMake will only accept Windows paths if they are environment variables, not CMake command line cache entries
env:
CMAKE_PREFIX_PATH: ${{ env.Qt6_DIR }}
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Package
run: cmake --build build --target package
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dukpt-${{ env.GIT_DESCRIBE }}-windows
path: |
build/dukpt-*.tar.gz
build/dukpt-*.exe
if-no-files-found: error
- name: Upload build directory if failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: dukpt-${{ env.GIT_DESCRIBE }}-windows-build
path: ./
if-no-files-found: error