From 5b875e1516a63d0cc82fac24678a9faec64bbf65 Mon Sep 17 00:00:00 2001 From: Aveen Ismail Date: Thu, 30 Nov 2023 14:34:05 +0100 Subject: [PATCH] githubactions: update workflow --- .github/workflows/macos_release.yml | 11 +- .github/workflows/windows_build.yml | 178 +++++++++++----------------- cmake/check.cmake | 1 + 3 files changed, 72 insertions(+), 118 deletions(-) diff --git a/.github/workflows/macos_release.yml b/.github/workflows/macos_release.yml index 5f428af5..fc99d014 100644 --- a/.github/workflows/macos_release.yml +++ b/.github/workflows/macos_release.yml @@ -13,7 +13,7 @@ jobs: RELEASE_VERSION: 2.3.1 steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install prerequisites run: | @@ -22,14 +22,13 @@ jobs: run: | set -x ./resources/make_src_dist.sh $RELEASE_VERSION - cd .. - mkdir artifact - mv $GITHUB_WORKSPACE/yubico-piv-tool-$RELEASE_VERSION.tar.gz artifact/ + mkdir $GITHUB_WORKSPACE/artifact + mv $GITHUB_WORKSPACE/yubico-piv-tool-$RELEASE_VERSION.tar.gz $GITHUB_WORKSPACE/artifact/ - name: Upload artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: yubico-piv-tool-src - path: ../artifact + path: artifact job_2: name: Build pkg from source diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index f8398b06..cc5dae1f 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -5,12 +5,12 @@ on: [push] jobs: - souce_build: + souce: name: Build dist with Linux runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install prerequisites run: | @@ -20,22 +20,37 @@ jobs: run: | set -x ./resources/make_src_dist.sh - cd .. - mkdir artifact - mv $GITHUB_WORKSPACE/yubico-piv-tool-.tar.gz artifact/ + mkdir $GITHUB_WORKSPACE/artifact + mv $GITHUB_WORKSPACE/yubico-piv-tool-.tar.gz $GITHUB_WORKSPACE/artifact/ - name: Upload artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: yubico-piv-tool-src - path: ../artifact - - win2019_x86: - name: Windows Server 2019 - x86 - needs: souce_build - runs-on: windows-2019 + path: artifact + + build: + name: Build and Test on Windows + needs: souce + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: windows-2019 + arch: x86 + arch_cmake: Win32 + - os: windows-2019 + arch: x64 + arch_cmake: x64 + - os: windows-2022 + arch: x86 + arch_cmake: Win32 + - os: windows-2022 + arch: x64 + arch_cmake: x64 steps: - - name: Download source from job_1 - uses: actions/download-artifact@v1 + - name: Download source from source + uses: actions/download-artifact@v3 with: name: yubico-piv-tool-src @@ -45,137 +60,76 @@ jobs: cd yubico-piv-tool-src tar xf yubico-piv-tool-.tar.gz - - name: install prerequisites for x86 architecture - run: | - Set-PSDebug -Trace 1 - vcpkg install openssl:x86-windows - vcpkg install getopt:x86-windows - vcpkg install check:x86-windows - - - name: build for x86 architecture - run: | - Set-PSDebug -Trace 1 - $env:Path ="C:/vcpkg/packages/openssl_x86-windows;$env:Path" - $env:include ="C:/vcpkg/packages/openssl_x86-windows/include;$env:include" - - cd yubico-piv-tool-src/yubico-piv-tool- - mkdir build; cd build - cmake -A Win32 -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x86-windows .. - cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x86-windows/bin;C:/vcpkg/packages/openssl_x86-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" - ctest.exe -C Debug - - - name: Build with YKCS11_DBG is set - run: | - Set-PSDebug -Trace 1 - $env:Path ="C:/vcpkg/packages/openssl_x86-windows;$env:Path" - $env:include ="C:/vcpkg/packages/openssl_x86-windows/include;$env:include" - - cd yubico-piv-tool-src/yubico-piv-tool- - rm -r build; mkdir build; cd build - cmake -A Win32 -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x86-windows -DYKCS11_DBG=3 .. - cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x86-windows/bin;C:/vcpkg/packages/openssl_x86-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" - ctest.exe -C Debug - - - name: Build only library (no CLI and no ykcs11) + - name: install prerequisites + env: + ARCH_CMAKE: ${{ matrix.arch_cmake }} + ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 - $env:Path ="C:/vcpkg/packages/openssl_x86-windows;$env:Path" - $env:include ="C:/vcpkg/packages/openssl_x86-windows/include;$env:include" - - cd yubico-piv-tool-src/yubico-piv-tool- - rm -r build; mkdir build; cd build - cmake -A Win32 -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x86-windows -DBUILD_ONLY_LIB=ON .. - cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x86-windows/bin;C:/vcpkg/packages/openssl_x86-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" - ctest.exe -C Debug - - - name: Build only dynamic libaries - run: | - Set-PSDebug -Trace 1 - $env:Path ="C:/vcpkg/packages/openssl_x86-windows;$env:Path" - $env:include ="C:/vcpkg/packages/openssl_x86-windows/include;$env:include" - - cd yubico-piv-tool-src/yubico-piv-tool- - rm -r build; mkdir build; cd build - cmake -A Win32 -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x86-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x86-windows -DBUILD_STATIC_LIB=OFF .. - cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x86-windows/bin;C:/vcpkg/packages/openssl_x86-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" - ctest.exe -C Debug - - win2019_x64: - name: Windows Server 2019 - x64 - needs: souce_build - runs-on: windows-2019 - - steps: - - name: Download source from job_1 - uses: actions/download-artifact@v1 - with: - name: yubico-piv-tool-src - - - name: Extract source - run: | - Set-PSDebug -Trace 1 - cd yubico-piv-tool-src - tar xf yubico-piv-tool-.tar.gz - - - name: install prerequisites for x64 architecture - run: | - Set-PSDebug -Trace 1 - vcpkg install openssl:x64-windows - vcpkg install getopt:x64-windows - vcpkg install check:x64-windows - - - name: build for x64 architecture + vcpkg install openssl:$env:ARCH-windows + vcpkg install getopt:$env:ARCH-windows + vcpkg install check:$env:ARCH-windows + + - name: build binaries + env: + ARCH_CMAKE: ${{ matrix.arch_cmake }} + ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 - $env:Path ="C:\vcpkg\packages\openssl_x64-windows;$env:Path" - $env:include ="C:\vcpkg\packages\openssl_x64-windows/include;$env:include" + $env:Path ="C:/vcpkg/packages/openssl_$env:ARCH-windows;$env:Path" + $env:include ="C:/vcpkg/packages/openssl_$env:ARCH-windows/include;$env:include" cd yubico-piv-tool-src/yubico-piv-tool- mkdir build; cd build - cmake -A x64 -DVERBOSE_CMAKE=ON -DBACKEND=winscard -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x64-windows .. + cmake -A $env:ARCH_CMAKE -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_$env:ARCH-windows .. cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x64-windows/bin;C:/vcpkg/packages/openssl_x64-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" + $env:Path +=";C:/vcpkg/packages/check_$env:ARCH-windows/bin;C:/vcpkg/packages/openssl_$env:ARCH-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" ctest.exe -C Debug - name: Build with YKCS11_DBG is set + env: + ARCH_CMAKE: ${{ matrix.arch_cmake }} + ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 - $env:Path ="C:\vcpkg\packages\openssl_x64-windows;$env:Path" - $env:include ="C:\vcpkg\packages\openssl_x64-windows/include;$env:include" + $env:Path ="C:/vcpkg/packages/openssl_$env:ARCH-windows;$env:Path" + $env:include ="C:/vcpkg/packages/openssl_$env:ARCH-windows/include;$env:include" cd yubico-piv-tool-src/yubico-piv-tool- rm -r build; mkdir build; cd build - cmake -A x64 -DVERBOSE_CMAKE=ON -DBACKEND=winscard -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x64-windows -DYKCS11_DBG=3 .. + cmake -A $env:ARCH_CMAKE -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_$env:ARCH-windows -DYKCS11_DBG=3 .. cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x64-windows/bin;C:/vcpkg/packages/openssl_x64-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" + $env:Path +=";C:/vcpkg/packages/check_$env:ARCH-windows/bin;C:/vcpkg/packages/openssl_$env:ARCH-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" ctest.exe -C Debug - name: Build only library (no CLI and no ykcs11) + env: + ARCH_CMAKE: ${{ matrix.arch_cmake }} + ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 - $env:Path ="C:\vcpkg\packages\openssl_x64-windows;$env:Path" - $env:include ="C:\vcpkg\packages\openssl_x64-windows/include;$env:include" + $env:Path ="C:/vcpkg/packages/openssl_$env:ARCH-windows;$env:Path" + $env:include ="C:/vcpkg/packages/openssl_$env:ARCH-windows/include;$env:include" cd yubico-piv-tool-src/yubico-piv-tool- rm -r build; mkdir build; cd build - cmake -A x64 -DVERBOSE_CMAKE=ON -DBACKEND=winscard -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x64-windows -DBUILD_ONLY_LIB=ON .. + cmake -A $env:ARCH_CMAKE -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_$env:ARCH-windows -DBUILD_ONLY_LIB=ON .. cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x64-windows/bin;C:/vcpkg/packages/openssl_x64-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" + $env:Path +=";C:/vcpkg/packages/check_$env:ARCH-windows/bin;C:/vcpkg/packages/openssl_$env:ARCH-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" ctest.exe -C Debug - name: Build only dynamic libaries + env: + ARCH_CMAKE: ${{ matrix.arch_cmake }} + ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 - $env:Path ="C:\vcpkg\packages\openssl_x64-windows;$env:Path" - $env:include ="C:\vcpkg\packages\openssl_x64-windows/include;$env:include" + $env:Path ="C:/vcpkg/packages/openssl_$env:ARCH-windows;$env:Path" + $env:include ="C:/vcpkg/packages/openssl_$env:ARCH-windows/include;$env:include" cd yubico-piv-tool-src/yubico-piv-tool- rm -r build; mkdir build; cd build - cmake -A x64 -DVERBOSE_CMAKE=ON -DBACKEND=winscard -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-win32_x64-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_x64-windows -DBUILD_STATIC_LIB=OFF .. + cmake -A $env:ARCH_CMAKE -DVERBOSE_CMAKE=ON -DGETOPT_LIB_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/lib -DGETOPT_INCLUDE_DIR=C:/vcpkg/packages/getopt-$env:ARCH_CMAKE_$env:ARCH-windows/include -DCHECK_PATH=C:/vcpkg/packages/check_$env:ARCH-windows -DBUILD_STATIC_LIB=OFF .. cmake --build . -v - $env:Path +=";C:/vcpkg/packages/check_x64-windows/bin;C:/vcpkg/packages/openssl_x64-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" + $env:Path +=";C:/vcpkg/packages/check_$env:ARCH-windows/bin;C:/vcpkg/packages/openssl_$env:ARCH-windows/bin;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\lib\Debug;$env:GITHUB_WORKSPACE\yubico-piv-tool-src\yubico-piv-tool-\build\ykcs11\Debug" ctest.exe -C Debug diff --git a/cmake/check.cmake b/cmake/check.cmake index 0c6085aa..e4971363 100644 --- a/cmake/check.cmake +++ b/cmake/check.cmake @@ -31,6 +31,7 @@ macro (find_check) if(NOT check_FOUND) find_package(check CONFIG PATHS ${CHECK_PATH}) if(check_FOUND) + message(WARNING "------------------ 'check' found.") set(LIBCHECK_LDFLAGS Check::check Check::checkShared) set(LIBCHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR}) set(LIBCHECK_VERSION ${CHECK_VERSION})