Add optional dependencies to windows and macos targets in build-tests.yml (#229)
Install and validate integration with as many optional dependencies on all testing platforms when doing CI build tests. - For windows-latest, use vcpkg to install zlib, libqrencode, and zint. - For macos-latest, use brew to install zlib, qrencode, and zint. - Made zint version detection more robust across platforms.
This commit is contained in:
@@ -6,16 +6,12 @@
|
|||||||
# - windows-latest - cl
|
# - windows-latest - cl
|
||||||
# - macos-latest - clang
|
# - macos-latest - clang
|
||||||
#
|
#
|
||||||
# TODO:
|
|
||||||
# - install optional dependencies for windows-latest and macos-latest
|
|
||||||
|
|
||||||
|
|
||||||
name: Multi-Platform Build Tests
|
name: Multi-Platform Build Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -66,24 +62,50 @@ jobs:
|
|||||||
# install zint-2.15.0 from source
|
# install zint-2.15.0 from source
|
||||||
wget https://downloads.sourceforge.net/project/zint/zint/2.15.0/zint-2.15.0-src.tar.gz && tar xzf zint-2.15.0-src.tar.gz && ( cd zint-2.15.0-src && mkdir build && cd build && cmake .. && make && sudo make install )
|
wget https://downloads.sourceforge.net/project/zint/zint/2.15.0/zint-2.15.0-src.tar.gz && tar xzf zint-2.15.0-src.tar.gz && ( cd zint-2.15.0-src && mkdir build && cd build && cmake .. && make && sudo make install )
|
||||||
|
|
||||||
|
- name: Pre-install vcpkg (Windows)
|
||||||
|
if: startsWith( matrix.os, 'windows-' )
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 https://github.com/microsoft/vcpkg.git
|
||||||
|
|
||||||
|
- name: Restore vcpkg cache (Windows)
|
||||||
|
if: startsWith(matrix.os, 'windows-')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/vcpkg/installed
|
||||||
|
${{ github.workspace }}/vcpkg/downloads
|
||||||
|
key: vcpkg-${{ runner.os }}-${{ hashFiles('.github/workflows/build-tests.yml') }}
|
||||||
|
restore-keys: |
|
||||||
|
vcpkg-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Install optional dependencies (Windows)
|
- name: Install optional dependencies (Windows)
|
||||||
if: startsWith( matrix.os, 'windows-' )
|
if: startsWith( matrix.os, 'windows-' )
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# install packages
|
# install packages
|
||||||
|
./vcpkg/bootstrap-vcpkg.sh
|
||||||
|
./vcpkg/vcpkg install pkgconf
|
||||||
|
./vcpkg/vcpkg install zlib
|
||||||
|
./vcpkg/vcpkg install libqrencode
|
||||||
|
./vcpkg/vcpkg install zint
|
||||||
|
echo "TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install optional dependencies (MacOS)
|
- name: Install optional dependencies (MacOS)
|
||||||
if: startsWith( matrix.os, 'macos-' )
|
if: startsWith( matrix.os, 'macos-' )
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# install packages
|
# install packages
|
||||||
|
brew install zlib
|
||||||
|
brew install qrencode
|
||||||
|
brew install zint
|
||||||
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
version: '6.2.*'
|
version: '6.2.*'
|
||||||
install-deps: 'true'
|
install-deps: 'true'
|
||||||
archives: 'qtbase qtsvg qttools icu'
|
archives: 'qtbase qtsvg qttools icu qttranslations'
|
||||||
|
|
||||||
- name: Set reusable strings
|
- name: Set reusable strings
|
||||||
id: strings
|
id: strings
|
||||||
@@ -97,6 +119,7 @@ jobs:
|
|||||||
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
|
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
|
||||||
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
|
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
|
||||||
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=${{ env.TOOLCHAIN_FILE }}
|
||||||
-S ${{ github.workspace }}
|
-S ${{ github.workspace }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|||||||
@@ -34,23 +34,36 @@ if (LIBZINT_LIBRARY AND LIBZINT_INCLUDE_DIR)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (LIBZINT_INCLUDE_DIR AND EXISTS "${LIBZINT_INCLUDE_DIR}/zint.h")
|
if (LIBZINT_INCLUDE_DIR AND EXISTS "${LIBZINT_INCLUDE_DIR}/zint.h")
|
||||||
|
# Before zint 2.10, version information was defined in macros in zint.h
|
||||||
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_MAJOR_H REGEX "^#define ZINT_VERSION_MAJOR *[0-9]*")
|
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_MAJOR_H REGEX "^#define ZINT_VERSION_MAJOR *[0-9]*")
|
||||||
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_MINOR_H REGEX "^#define ZINT_VERSION_MINOR *[0-9]*")
|
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_MINOR_H REGEX "^#define ZINT_VERSION_MINOR *[0-9]*")
|
||||||
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_MICRO_H REGEX "^#define ZINT_VERSION_RELEASE *[0-9]*")
|
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_MICRO_H REGEX "^#define ZINT_VERSION_RELEASE *[0-9]*")
|
||||||
if (ZINT_MAJOR_H) # ZINT_MINOR_H and ZINT_MICRO_H may be zero so don't test
|
if (ZINT_MAJOR_H) # ZINT_MINOR_H and ZINT_MICRO_H may be zero so don't test
|
||||||
string (REGEX REPLACE "^.*VERSION_MAJOR *([0-9]*)" "\\1" ZINT_MAJOR ${ZINT_MAJOR_H})
|
string (REGEX REPLACE "^.*VERSION_MAJOR *([0-9]*)" "\\1" ZINT_MAJOR "${ZINT_MAJOR_H}")
|
||||||
string (REGEX REPLACE "^.*VERSION_MINOR *([0-9]*)" "\\1" ZINT_MINOR "${ZINT_MINOR_H}")
|
string (REGEX REPLACE "^.*VERSION_MINOR *([0-9]*)" "\\1" ZINT_MINOR "${ZINT_MINOR_H}")
|
||||||
string (REGEX REPLACE "^.*VERSION_RELEASE *([0-9]*)" "\\1" ZINT_MICRO "${ZINT_MICRO_H}")
|
string (REGEX REPLACE "^.*VERSION_RELEASE *([0-9]*)" "\\1" ZINT_MICRO "${ZINT_MICRO_H}")
|
||||||
set (LIBZINT_VERSION_STRING ${ZINT_MAJOR}.${ZINT_MINOR}.${ZINT_MICRO})
|
set (LIBZINT_VERSION_STRING ${ZINT_MAJOR}.${ZINT_MINOR}.${ZINT_MICRO})
|
||||||
math (EXPR LIBZINT_VERSION "${ZINT_MAJOR} * 10000 + ${ZINT_MINOR} * 100 + ${ZINT_MICRO}")
|
math (EXPR LIBZINT_VERSION "${ZINT_MAJOR} * 10000 + ${ZINT_MINOR} * 100 + ${ZINT_MICRO}")
|
||||||
else ()
|
else ()
|
||||||
execute_process(COMMAND "zint" "-h" OUTPUT_VARIABLE EXEC_ZINT_VERSION ERROR_QUIET)
|
# For zint 2.10+, version macros are no longer available in public header files -- query zint command
|
||||||
|
find_program (ZINT_COMMAND NAMES zint zint.exe)
|
||||||
|
execute_process(COMMAND ${ZINT_COMMAND} "-v" OUTPUT_VARIABLE EXEC_ZINT_VERSION ERROR_QUIET)
|
||||||
if (EXEC_ZINT_VERSION)
|
if (EXEC_ZINT_VERSION)
|
||||||
string (REGEX REPLACE "^Zint version ([0-9.]+).*$" "\\1" LIBZINT_VERSION_STRING ${EXEC_ZINT_VERSION})
|
string (REGEX REPLACE "^Zint version ([0-9.]+).*$" "\\1" LIBZINT_VERSION_STRING ${EXEC_ZINT_VERSION})
|
||||||
string (REGEX REPLACE "^([0-9]+).*$" "\\1" ZINT_MAJOR ${LIBZINT_VERSION_STRING})
|
string (REGEX REPLACE "^([0-9]+).*$" "\\1" ZINT_MAJOR ${LIBZINT_VERSION_STRING})
|
||||||
string (REGEX REPLACE "^[0-9]+\.([0-9]+).*$" "\\1" ZINT_MINOR ${LIBZINT_VERSION_STRING})
|
string (REGEX REPLACE "^[0-9]+\.([0-9]+).*$" "\\1" ZINT_MINOR ${LIBZINT_VERSION_STRING})
|
||||||
string (REGEX REPLACE "^[0-9]+\.[0-9]+\.([0-9]+).*$" "\\1" ZINT_MICRO ${LIBZINT_VERSION_STRING})
|
string (REGEX REPLACE "^[0-9]+\.[0-9]+\.([0-9]+).*$" "\\1" ZINT_MICRO ${LIBZINT_VERSION_STRING})
|
||||||
math (EXPR LIBZINT_VERSION "${ZINT_MAJOR} * 10000 + ${ZINT_MINOR} * 100 + ${ZINT_MICRO}")
|
math (EXPR LIBZINT_VERSION "${ZINT_MAJOR} * 10000 + ${ZINT_MINOR} * 100 + ${ZINT_MICRO}")
|
||||||
|
else ()
|
||||||
|
# As a last resort, look for the Version comment in zint.h (has not always been present)
|
||||||
|
file (STRINGS "${LIBZINT_INCLUDE_DIR}/zint.h" ZINT_VERSION_STRING_H REGEX "^.*Version: *[0-9\.]*")
|
||||||
|
if (ZINT_VERSION_STRING_H)
|
||||||
|
string (REGEX REPLACE "^.*([0-9]+\.[0-9]+\.[0-9]).*$" "\\1" LIBZINT_VERSION_STRING "${ZINT_VERSION_STRING_H}")
|
||||||
|
string (REGEX REPLACE "^([0-9]+).*$" "\\1" ZINT_MAJOR ${LIBZINT_VERSION_STRING})
|
||||||
|
string (REGEX REPLACE "^[0-9]+\.([0-9]+).*$" "\\1" ZINT_MINOR ${LIBZINT_VERSION_STRING})
|
||||||
|
string (REGEX REPLACE "^[0-9]+\.[0-9]+\.([0-9]+).*$" "\\1" ZINT_MICRO ${LIBZINT_VERSION_STRING})
|
||||||
|
math (EXPR LIBZINT_VERSION "${ZINT_MAJOR} * 10000 + ${ZINT_MINOR} * 100 + ${ZINT_MICRO}")
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
Reference in New Issue
Block a user