-
Notifications
You must be signed in to change notification settings - Fork 57
247 lines (219 loc) · 8.39 KB
/
build-member.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: Build Libraries and CLI + Run CTS
on:
push:
branches:
- master
paths-ignore:
- '.github/**'
- '!.github/workflows/build-member.yml'
- '.gitignore'
- '**.md'
- 'conformance/**'
- 'NFIQ2/NFIQ2Algorithm/doc/**'
env:
CONFIGURATION: Release
BUILD_NFIQ2_CLI: ON
jobs:
build:
name: Build Matrix + CTS
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
# https://github.com/actions/virtual-environments
- { os: macOS-14, arch: arm64, embed_rf: OFF }
- { os: macOS-13, arch: x64, embed_rf: OFF }
- { os: macOS-12, arch: x64, embed_rf: OFF }
- { os: ubuntu-24.04, arch: x64, embed_rf: ON }
- { os: ubuntu-24.04, arch: x64, embed_rf: OFF }
- { os: ubuntu-22.04, arch: x64, embed_rf: ON }
- { os: ubuntu-22.04, arch: x64, embed_rf: OFF }
- { os: ubuntu-20.04, arch: x64, embed_rf: OFF }
- { os: windows-2022, arch: x64, embed_rf: OFF }
- { os: windows-2022, arch: x86, embed_rf: OFF }
- { os: windows-2019, arch: x64, embed_rf: OFF }
- { os: windows-2019, arch: x86, embed_rf: OFF }
steps:
- name: Checkout Code and Submodules
uses: actions/checkout@v4
with:
submodules: true
# The Mono framework on macOS GitHub Runners provides some really old and
# conflicting libraries at high precedence, so remove it.
- name: Remove Mono Framework (macOS)
if: ${{ runner.os == 'macOS' }}
shell: bash
run: sudo rm -rf /Library/Frameworks/Mono.framework
- name: Prepare for Package Cache (Windows)
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
mkdir -p "${VCPKG_INSTALLATION_ROOT}/bincache"
echo "VCPKG_DEFAULT_BINARY_CACHE=${VCPKG_INSTALLATION_ROOT}/bincache" >> ${GITHUB_ENV}
- name: Package Cache (Windows)
if: ${{ runner.os == 'Windows' }}
id: vcpkg-cache
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-vcpkg
restore-keys: |
${{ matrix.config.os }}-${{ matrix.config.arch }}-vcpkg
- name: Install Packages (Linux)
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
sudo apt -y update
sudo apt -y install \
libdb++-dev \
libhwloc-dev \
libjbig-dev \
libjpeg-dev \
liblzma-dev \
libopenjp2-7-dev \
libpng-dev \
libsqlite3-dev \
libssl-dev \
libtiff-dev \
libwebp-dev \
libzstd-dev \
zlib1g-dev
- name: Install Packages (macOS)
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 \
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --quiet \
berkeley-db \
hwloc \
jpeg-turbo \
libpng \
libtiff \
openjpeg \
openssl \
sqlite \
zlib \
zstd
- name: Install Packages (Windows)
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
vcpkg install --recurse \
--triplet=${{ matrix.config.arch }}-windows-static \
berkeleydb \
hwloc \
libjpeg-turbo \
liblzma \
libpng \
openjpeg \
openssl \
sqlite3 \
tiff \
zlib \
zstd
# getopt is not static
vcpkg install --recurse \
--triplet=${{ matrix.config.arch }}-windows getopt
- name: Build Directory Cache
id: builddir-cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build
!${{ github.workspace }}/build/nfir*
!${{ github.workspace }}/build/nfiq2api-prefix/src/nfiq2api-build/CMakeFiles/Nfiq2Api.dir/version.AppleClang.apple64.cpp.o*
!${{ github.workspace }}/build/nfiq2-prefix/src/nfiq2-build/CMakeFiles/nfiq2-static-lib.dir/src/nfiq2/version.cpp.o*
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-builddir-ocv410
- name: Get CMake Version
shell: bash
run: cmake --version
- name: Create Build Directory
if: steps.builddir-cache.outputs.cache-hit != 'true'
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake (Single-config Generator)
if: ${{ runner.os != 'Windows' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
cmake \
-DCMAKE_BUILD_TYPE="${CONFIGURATION}" \
-DBUILD_NFIQ2_CLI="${BUILD_NFIQ2_CLI}" \
-DEMBED_RANDOM_FOREST_PARAMETERS="${{ matrix.config.embed_rf }}" \
${GITHUB_WORKSPACE}
- name: Configure CMake (Multi-config Generator)
if: ${{ runner.os == 'Windows' }}
shell: bash
env:
cmake_arch_flag: ${{ matrix.config.arch == 'x86' && 'Win32' || 'x64' }}
working-directory: ${{ github.workspace }}\build
run: |
cmake \
-A ${cmake_arch_flag} \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="${{ matrix.config.arch }}-windows-static" \
-DCMAKE_CONFIGURATION_TYPES="${CONFIGURATION}" \
-DVCPKG_VERBOSE=ON \
-DBUILD_NFIQ2_CLI="${BUILD_NFIQ2_CLI}" \
-DEMBED_RANDOM_FOREST_PARAMETERS="${{ matrix.config.embed_rf }}" \
-DOPENSSL_ROOT_DIR="${VCPKG_INSTALLATION_ROOT}/packages/openssl_${{ matrix.config.arch }}-windows-static" \
${GITHUB_WORKSPACE}
- name: Build (Single-config Generator)
if: ${{ runner.os != 'Windows' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: cmake --build .
- name: Build (Multi-config Generator)
if: ${{ runner.os == 'Windows' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: cmake --build . --config ${CONFIGURATION}
- name: Show Dependencies (Linux)
if: ${{ runner.os == 'Linux' }}
working-directory: ${{ github.workspace }}/build
shell: bash
run: ldd install_staging/nfiq2/bin/nfiq2
- name: Show Dependencies (macOS)
if: ${{ runner.os == 'macOS' }}
working-directory: ${{ github.workspace }}/build
shell: bash
run: otool -L install_staging/nfiq2/bin/nfiq2
- name: Download Conformance Test
working-directory: ${{ github.workspace }}/conformance
shell: bash
run: curl -o nfiq2_conformance.zip -L ${{ secrets.NFIQ2_CONFORMANCE_DATASET_URL }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up external model argument (Windows)
if: matrix.config.embed_rf == 'OFF' && runner.os == 'Windows'
shell: bash
run: echo "NFIQ2_CLI_MODEL_ARGUMENT=-m ../build/install_staging/nfiq2/bin/nist_plain_tir-ink.txt" >> $GITHUB_ENV
- name: Set up external model argument (Linux/macOS)
if: matrix.config.embed_rf == 'OFF' && runner.os != 'Windows'
shell: bash
run: echo "NFIQ2_CLI_MODEL_ARGUMENT=-m ../build/install_staging/nfiq2/share/nist_plain_tir-ink.txt" >> $GITHUB_ENV
- name: Set up embedded model argument
if: ${{ matrix.config.embed_rf == 'ON' }}
shell: bash
run: echo "NFIQ2_CLI_MODEL_ARGUMENT=" >> $GITHUB_ENV
- name: Run Conformance Test (Windows)
if: ${{ runner.os == 'Windows' }}
working-directory: ${{ github.workspace }}/conformance
shell: bash
run: |
unzip -q nfiq2_conformance.zip
../build/install_staging/nfiq2/bin/nfiq2 ${{ env.NFIQ2_CLI_MODEL_ARGUMENT }} -i nfiq2_conformance/images -a -v -q -o github.csv
- name: Run Conformance Test (Linux)
if: ${{ runner.os != 'Windows' }}
working-directory: ${{ github.workspace }}/conformance
shell: bash
run: |
unzip -q nfiq2_conformance.zip
../build/install_staging/nfiq2/bin/nfiq2 ${{ env.NFIQ2_CLI_MODEL_ARGUMENT }} -i nfiq2_conformance/images -a -v -q -o github.csv
- name: Diff Conformance Test
working-directory: ${{ github.workspace }}/conformance
shell: bash
run: |
python -m pip install pandas==2.1.4 packaging
python ./diff.py -s conformance_expected_output-v2.3.0.csv github.csv