Fix for build failures due to missing uint8_t (#380) #96
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
name: Build Libraries and CLI + Run CTS | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/**' | |
- '!.github/workflows/build-member.yml' | |
- '.gitignore' | |
- '**.md' | |
- 'conformance/**' | |
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-13, arch: x64, embed_rf: OFF } | |
- { os: macOS-12, 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 \ | |
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-ocv454 | |
- 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.csv github.csv |