From 68010e2de1cf052672a3ec45273ead34801bf3f3 Mon Sep 17 00:00:00 2001 From: Aveen Ismail <42414844+aveenismail@users.noreply.github.com> Date: Thu, 30 May 2024 13:34:40 +0200 Subject: [PATCH] Githubactions paths (#405) Update Githubaction workflows --- .github/workflows/build_and_test.yml | 2 +- .github/workflows/build_and_test_windows.yml | 56 +++++++++++-------- .github/workflows/integration_test.yml | 4 +- .github/workflows/release.yml | 15 +++-- .../release/macos/make_release_binaries.sh | 11 +--- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 54ac6dfeb..45ed4e110 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -308,7 +308,7 @@ jobs: run: brew install gengetopt help2man libedit - name: clone the Yubico/yubihsm-shell repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: yubihsm-shell diff --git a/.github/workflows/build_and_test_windows.yml b/.github/workflows/build_and_test_windows.yml index ba0eacd83..d5a7ec81d 100644 --- a/.github/workflows/build_and_test_windows.yml +++ b/.github/workflows/build_and_test_windows.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install prerequisites run: | set -x @@ -22,7 +22,7 @@ jobs: mkdir $GITHUB_WORKSPACE/artifact mv $GITHUB_WORKSPACE/yubihsm-shell-.tar.gz $GITHUB_WORKSPACE/artifact/ - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: yubihsm-shell-src path: artifact @@ -49,8 +49,8 @@ jobs: arch_cmake: x64 steps: - - name: Download source from job_1 - uses: actions/download-artifact@v3 + - name: Download source from source job + uses: actions/download-artifact@v4 with: name: yubihsm-shell-src @@ -66,7 +66,9 @@ jobs: run: | Set-PSDebug -Trace 1 $YHSHELL_SRC_DIR="$env:GITHUB_WORKSPACE\yubihsm-shell-" - $MERGEDPATH = Get-ChildItem "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\v143\MergeModules\Microsoft_VC143_CRT_$env:ARCH.msm" + $MERGEDPATH = Get-ChildItem "C:\Program Files*\Microsoft Visual Studio\*\Enterprise\VC\Redist\MSVC\v14*\MergeModules\Microsoft_VC*_CRT_$env:ARCH.msm" + + echo "MERGEDPATH = $MERGEDPATH" cd $YHSHELL_SRC_DIR/resources/release/win ./make_release_binaries.ps1 $env:ARCH_CMAKE C:/vcpkg @@ -74,37 +76,47 @@ jobs: ./yubihsm-shell.exe --help | findstr "Usage: yubihsm-shell [OPTION]" cd $YHSHELL_SRC_DIR/resources/release/win ./repack_installer.ps1 $env:ARCH $env:WIX\bin "$MERGEDPATH" - #cp yubihsm-shell-$env:ARCH.msi yubihsm-shell.msi + cp yubihsm-shell-$env:ARCH.msi yubihsm-shell.msi - - name: Test installer and PKCS11 module + - name: Install yubihsm-shell from installer + run: | + Set-PSDebug -Trace 1 + $log = "$env:GITHUB_WORKSPACE\install_shell.log" + Start-Process "msiexec" "/i `"$env:GITHUB_WORKSPACE\yubihsm-shell-\resources\release\win\yubihsm-shell.msi`" /qn /norestart /L*v `"$log`"" -NoNewWindow -PassThru + + - name: Install OpenSC env: ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 - - cd $env:GITHUB_WORKSPACE\yubihsm-shell-\resources\release\win - - # No actual connection, but this is enough to make sure that the PKCS11 module is found and loaded - $PKCS11_CONFIG="connector=http://127.0.0.1:12345" - $PKCS11_CONFIG | Out-File $env:GITHUB_WORKSPACE\yubihsm_pkcs11.conf - $env:YUBIHSM_PKCS11_CONF="$env:GITHUB_WORKSPACE\yubihsm_pkcs11.conf" - + if($env:ARCH -eq "x86") { - Invoke-WebRequest -Uri https://github.com/OpenSC/OpenSC/releases/download/0.23.0/OpenSC-0.23.0_win32.msi -OutFile OpenSC-0.23.0.msi -UseBasicParsing + Invoke-WebRequest -Uri https://github.com/OpenSC/OpenSC/releases/download/0.25.1/OpenSC-0.25.1_win32.msi -OutFile OpenSC.msi -UseBasicParsing } else { - Invoke-WebRequest -Uri https://github.com/OpenSC/OpenSC/releases/download/0.23.0/OpenSC-0.23.0_win64.msi -OutFile OpenSC-0.23.0.msi -UseBasicParsing + Invoke-WebRequest -Uri https://github.com/OpenSC/OpenSC/releases/download/0.25.1/OpenSC-0.25.1_win64.msi -OutFile OpenSC.msi -UseBasicParsing } - $log = "$env:GITHUB_WORKSPACE\install.log" - $procMain = Start-Process "msiexec" "/i `"OpenSC-0.23.0.msi`" /qn /l*! `"$log`"" -NoNewWindow -PassThru - $procMain.WaitForExit() - $procMain = Start-Process "msiexec" "/i `"yubihsm-shell-$env:ARCH.msi`" /qn /l*! `"$log`"" -NoNewWindow -PassThru - $procMain.WaitForExit() + Start-Sleep -Seconds 120 + $log = "$env:GITHUB_WORKSPACE\install_opensc.log" + Start-Process "msiexec" "/i `"$env:GITHUB_WORKSPACE\OpenSC.msi`" /qn /l*! `"$log`"" -Wait -NoNewWindow -PassThru + - name: Test PKCS11 module + env: + ARCH: ${{ matrix.arch }} + + run: | + Set-PSDebug -Trace 1 + + cd $env:GITHUB_WORKSPACE\yubihsm-shell-\resources\release\win + + # No actual connection, but this is enough to make sure that the PKCS11 module is found and loaded + $PKCS11_CONFIG="connector=http://127.0.0.1:12345" + $PKCS11_CONFIG | Out-File $env:GITHUB_WORKSPACE\yubihsm_pkcs11.conf + $env:YUBIHSM_PKCS11_CONF="$env:GITHUB_WORKSPACE\yubihsm_pkcs11.conf" if($env:ARCH -eq "x86") { diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 0d4040c41..ec7945876 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -30,7 +30,7 @@ jobs: jq - name: clone the Yubico/yubihsm-shell repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: yubihsm-shell @@ -85,7 +85,7 @@ jobs: ./opensc_test.sh $GITHUB_WORKSPACE/yubihsm-shell/build/pkcs11/yubihsm_pkcs11.so - name: clone the YubicoLabs/yubihsm_sunpkcs11_tests repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: YubicoLabs/yubihsm_sunpkcs11_tests path: yubihsm_sunpkcs11_tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d451fb31d..fa9d6d952 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: VERSION: 2.5.0 steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install prerequisites run: | set -x @@ -26,7 +26,7 @@ jobs: mkdir $GITHUB_WORKSPACE/artifact mv $GITHUB_WORKSPACE/yubihsm-shell-$VERSION.tar.gz $GITHUB_WORKSPACE/artifact/ - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: yubihsm-shell-src path: artifact @@ -47,7 +47,7 @@ jobs: VERSION: 2.5.0 steps: - name: Download source from source job - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: yubihsm-shell-src @@ -56,13 +56,12 @@ jobs: Set-PSDebug -Trace 1 tar xf yubihsm-shell-$env:VERSION.tar.gz - - name: Build and make MSI installer + - name: Build release binaries env: ARCH: ${{ matrix.arch }} run: | Set-PSDebug -Trace 1 $YHSHELL_SRC_DIR="$env:GITHUB_WORKSPACE\yubihsm-shell-$env:VERSION" - $MERGEDPATH = Get-ChildItem "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\v143\MergeModules\Microsoft_VC143_CRT_$env:ARCH.msm" cd $YHSHELL_SRC_DIR/resources/release/win if($env:ARCH -eq "x86") @@ -79,7 +78,7 @@ jobs: - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: yubihsm-shell-${{ matrix.arch }} path: artifact @@ -101,7 +100,7 @@ jobs: SO_VERSION: 2 steps: - name: Download source from source job - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: yubihsm-shell-src @@ -126,7 +125,7 @@ jobs: cp -r $YHSHELL_SRC_DIR/resources/release/macos/yubihsm-shell-darwin-$ARCH-$VERSION $GITHUB_WORKSPACE/artifact/ - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: yubihsm-shell-darwin-${{ matrix.arch }}64 path: artifact diff --git a/resources/release/macos/make_release_binaries.sh b/resources/release/macos/make_release_binaries.sh index 33f3c840d..2d70cf672 100755 --- a/resources/release/macos/make_release_binaries.sh +++ b/resources/release/macos/make_release_binaries.sh @@ -6,16 +6,7 @@ ARCH=$1 # amd or arm VERSION=$2 # Full yubico-piv-tool version, tex 2.1.0 SO_VERSION=$3 -if [ "$ARCH" == "amd" ]; then - BREW_LIB="/usr/local/opt" - #BREW_CELLAR="/usr/local/Cellar" -elif [ "$ARCH" == "arm" ]; then - BREW_LIB="/opt/homebrew/opt" - #BREW_CELLAR="/opt/homebrew/Cellar" -else - echo "Unknown architecture" - exit -fi +BREW_LIB="/opt/homebrew/opt" brew install cmake pkg-config gengetopt help2man openssl