From 937d07ded2c467e89bcaa67220b59f8c83935a27 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 4 Apr 2025 11:14:26 +0200 Subject: [PATCH] CI: fix XIMEA URL --- .github/scripts/Linux/install_others.sh | 8 ++----- .github/scripts/environment.sh | 30 +++++++++++++++++++++++++ .github/scripts/macOS/install_others.sh | 3 +-- .github/workflows/ccpp.yml | 8 +++---- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/scripts/Linux/install_others.sh b/.github/scripts/Linux/install_others.sh index a3bc4cfcd..f74d17da8 100755 --- a/.github/scripts/Linux/install_others.sh +++ b/.github/scripts/Linux/install_others.sh @@ -7,12 +7,8 @@ if [ "$(id -u)" -eq 0 ]; then fi install_ximea() { - if [ "$(dpkg --print-architecture | cut -b1-3)" = arm ]; then - filename=XIMEA_Linux_ARM_SP.tgz - else - filename=XIMEA_Linux_SP.tgz - fi - curl -LO https://www.ximea.com/downloads/recent/$filename + filename=XIMEA.tgz + curl -L "$XIMEA_DOWNLOAD_URL" -o "$filename" tar xzf $filename cd package sudo ./install -noudev diff --git a/.github/scripts/environment.sh b/.github/scripts/environment.sh index 8b0f5dac0..27336ebae 100644 --- a/.github/scripts/environment.sh +++ b/.github/scripts/environment.sh @@ -116,6 +116,36 @@ if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" != arm64 ]; then printf "UG_ARCH=%s\n" $UG_ARCH >> "$GITHUB_ENV" fi + +set_ximea_url() { + if [ "$(uname -s)" = Darwin ]; then + if [ "$(uname -m)" = arm64 ]; then + ximea_pattern=XIMEA_macOS_ARM_SP.dmg + else + ximea_pattern=XIMEA_macOX_SP.dmg + fi + elif [ "$(uname -s)" = Linux ]; then + if expr "$GITHUB_WORKFLOW" : ARM >/dev/null; then + ximea_pattern=Linux_ARM_SP.tgz + else + ximea_pattern=Linux_SP.tgz + fi + else + ximea_pattern=XIMEA_Windows_SP_Stable.exe + fi + # ignore GUID 35adfeed-8e15-4b4d-8364-bd5a65cba5c4 because it is + # ARM (LTS) with pattern Linux_SP.tgz and since it listed first, + # it will be downloaded for x86, ARM beta is OK + ximea_path=$(curl https://www.ximea.com/software-downloads | + grep -v 35adfeed-8e15-4b4d-8364-bd5a65cba5c4 | + sed -n "/$ximea_pattern/"\ +' { s-^.*\(/getattachment[^"]*\).*$-\1-; p; q; }') + XIMEA_DOWNLOAD_URL=https://www.ximea.com$ximea_path + export XIMEA_DOWNLOAD_URL + printf "XIMEA_DOWNLOAD_URL=%s\n" "$XIMEA_DOWNLOAD_URL" >> "$GITHUB_ENV" +} +set_ximea_url + import_signing_key() { if [ "$(uname -s)" != Darwin ] || [ -z "$apple_key_p12_b64" ]; then return 0 diff --git a/.github/scripts/macOS/install_others.sh b/.github/scripts/macOS/install_others.sh index 073e9704e..70a996dc3 100755 --- a/.github/scripts/macOS/install_others.sh +++ b/.github/scripts/macOS/install_others.sh @@ -19,8 +19,7 @@ fi install_ximea() {( installer=/private/var/tmp/XIMEA_OSX_SP.dmg if [ ! -f $installer ]; then - curl -S -L https://www.ximea.com/downloads/recent/XIMEA_OSX_SP\ -.dmg -o $installer + curl -S -L "$XIMEA_DOWNLOAD_URL" -o $installer fi hdiutil mount $installer sudo cp -a /Volumes/XIMEA/m3api.framework \ diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 6b0fd0328..d2324a329 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -151,7 +151,7 @@ jobs: run: | echo "nonfree=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh "$SDK_URL/$DELTA_MAC_ARCHIVE")" >> $GITHUB_OUTPUT echo "ndi=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh https://downloads.ndi.tv/SDK/NDI_SDK_Mac/Install_NDI_SDK_v6_Apple.pkg)" >> $GITHUB_OUTPUT - echo "ximea=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh https://www.ximea.com/downloads/recent/XIMEA_OSX_SP.dmg)" >> $GITHUB_OUTPUT + echo "ximea=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh "$XIMEA_DOWNLOAD_URL")" >> $GITHUB_OUTPUT - name: Set environment run: . .github/scripts/environment.sh - name: Run actions/cache for Non-Free SDKs @@ -175,7 +175,7 @@ jobs: key: cache-ximea-${{ runner.os }}-${{ steps.etags.outputs.ximea }} - name: Download XIMEA if: steps.cache-macos-ximea.outputs.cache-hit != 'true' - run: curl -S -L https://www.ximea.com/downloads/recent/XIMEA_OSX_SP.dmg -o /private/var/tmp/XIMEA_OSX_SP.dmg + run: curl -S -L "$XIMEA_DOWNLOAD_URL" -o /private/var/tmp/XIMEA_OSX_SP.dmg - name: Run actions/cache for NDI id: cache-ndi uses: actions/cache@main @@ -242,7 +242,7 @@ jobs: id: etags run: | echo "ndi=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh https://downloads.ndi.tv/SDK/NDI_SDK/NDI%206%20SDK.exe)" >> $GITHUB_OUTPUT - echo "ximea=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh https://www.ximea.com/support/attachments/download/37/XIMEA_API_Installer.exe)" >> $GITHUB_OUTPUT + echo "ximea=$($GITHUB_WORKSPACE/.github/scripts/get-etags.sh "$XIMEA_DOWNLOAD_URL")" >> $GITHUB_OUTPUT - name: Set environment run: .github/scripts/environment.sh - name: Find MSVC @@ -265,7 +265,7 @@ jobs: key: cache-ximea-${{ runner.os }}-${{ steps.etags.outputs.ximea }} - name: Download XIMEA if: steps.cache-macos-ximea.outputs.cache-hit != 'true' - run: curl 'https://www.ximea.com/support/attachments/download/37/XIMEA_API_Installer.exe' -o 'C:\XIMEA_API_Installer.exe' + run: curl "$XIMEA_DOWNLOAD_URL" -o 'C:\XIMEA_API_Installer.exe' - name: Run actions/cache for libajantv2 build id: cache-aja