From 4b5180407b45cddcbf92a8b0c82320e4b22e5a4a Mon Sep 17 00:00:00 2001 From: Peter L Jones Date: Sun, 23 Aug 2026 16:31:25 +0100 Subject: [PATCH] Externalise cache keys to prevent unneeded invalidation --- .github/autobuild/ios-dependencies.sh | 6 ++++++ .github/autobuild/ios.sh | 10 ++++++---- .github/autobuild/mac-dependencies.sh | 7 +++++++ .github/autobuild/mac.sh | 11 +++++++---- .github/autobuild/windows-dependencies.ps1 | 8 ++++++++ .github/autobuild/windows.ps1 | 13 +++---------- .github/workflows/autobuild.yml | 16 ++++++++++++++-- .github/workflows/bump-dependencies.yml | 8 ++++---- 8 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 .github/autobuild/ios-dependencies.sh create mode 100644 .github/autobuild/mac-dependencies.sh create mode 100644 .github/autobuild/windows-dependencies.ps1 diff --git a/.github/autobuild/ios-dependencies.sh b/.github/autobuild/ios-dependencies.sh new file mode 100644 index 0000000000..eb77080b3e --- /dev/null +++ b/.github/autobuild/ios-dependencies.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Values are consumed by ios.sh and the dependency cache key. +# shellcheck disable=SC2034 +export AQTINSTALL_VERSION="${AQTINSTALL_VERSION:-3.3.0}" +export QT_VERSION="${QT_VERSION:-5.15.2}" diff --git a/.github/autobuild/ios.sh b/.github/autobuild/ios.sh index 952b88935f..efb6314b45 100755 --- a/.github/autobuild/ios.sh +++ b/.github/autobuild/ios.sh @@ -48,10 +48,12 @@ set -eu +PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +readonly PROJECT_DIR +# shellcheck disable=SC1091 +source "${PROJECT_DIR}/.github/autobuild/ios-dependencies.sh" + QT_DIR=/opt/qt -# The following version pinnings are semi-automatically checked for -# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually: -AQTINSTALL_VERSION=3.3.0 if [[ ! ${QT_VERSION:-} =~ [0-9]+\.[0-9]+\..* ]]; then echo "Environment variable QT_VERSION must be set to a valid Qt version" @@ -63,7 +65,7 @@ if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then fi setup() { - if [[ -d "${QT_DIR}" ]]; then + if [[ -x "${QT_DIR}/${QT_VERSION}/ios/bin/qmake" ]]; then echo "Using Qt installation from previous run (actions/cache)" else echo "Installing Qt" diff --git a/.github/autobuild/mac-dependencies.sh b/.github/autobuild/mac-dependencies.sh new file mode 100644 index 0000000000..deb0254521 --- /dev/null +++ b/.github/autobuild/mac-dependencies.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Values are consumed by mac.sh and the dependency cache key. +# shellcheck disable=SC2034 +export AQTINSTALL_VERSION="${AQTINSTALL_VERSION:-3.3.0}" +export QT_VERSION="${QT_VERSION:-6.10.2}" +export QT_LEGACY_VERSION=5.15.2 diff --git a/.github/autobuild/mac.sh b/.github/autobuild/mac.sh index a70cedc9e9..cacae3c937 100755 --- a/.github/autobuild/mac.sh +++ b/.github/autobuild/mac.sh @@ -48,10 +48,12 @@ set -eu +PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +readonly PROJECT_DIR +# shellcheck disable=SC1091 +source "${PROJECT_DIR}/.github/autobuild/mac-dependencies.sh" + QT_DIR=~/qt -# The following version pinnings are semi-automatically checked for -# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually: -AQTINSTALL_VERSION=3.3.0 TARGET_ARCHS="${TARGET_ARCHS:-}" @@ -65,7 +67,8 @@ if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then fi setup() { - if [[ -d "${QT_DIR}" ]]; then + if [[ -x "${QT_DIR}/${QT_VERSION}/macos/bin/qmake" && + -x "${QT_DIR}/${QT_VERSION}/macos/bin/macdeployqt" ]]; then echo "Using Qt installation from previous run (actions/cache)" else echo "Installing Qt..." diff --git a/.github/autobuild/windows-dependencies.ps1 b/.github/autobuild/windows-dependencies.ps1 new file mode 100644 index 0000000000..b31c2b0712 --- /dev/null +++ b/.github/autobuild/windows-dependencies.ps1 @@ -0,0 +1,8 @@ +# Values are consumed by windows.ps1 and the dependency cache key. +$Qt32Version = "5.15.2" +$Qt64Version = "6.10.2" +$AqtinstallVersion = "3.3.0" +$JackVersion = "1.9.22" +$Msvc32Version = "win32_msvc2019" +$Msvc64Version = "win64_msvc2022_64" +$JomVersion = "1.1.2" \ No newline at end of file diff --git a/.github/autobuild/windows.ps1 b/.github/autobuild/windows.ps1 index 263fdc20d6..b09018ccd4 100644 --- a/.github/autobuild/windows.ps1 +++ b/.github/autobuild/windows.ps1 @@ -68,15 +68,7 @@ $ProgressPreference = 'SilentlyContinue' $QtDir = 'C:\Qt' $ChocoCacheDir = 'C:\ChocoCache' $DownloadCacheDir = 'C:\AutobuildCache' -# The following version pinnings are semi-automatically checked for -# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually: -$Qt32Version = "5.15.2" -$Qt64Version = "6.10.2" -$AqtinstallVersion = "3.3.0" -$JackVersion = "1.9.22" -$Msvc32Version = "win32_msvc2019" -$Msvc64Version = "win64_msvc2022_64" -$JomVersion = "1.1.2" +. "$PSScriptRoot\windows-dependencies.ps1" # Compose JACK download urls $JackBaseUrl = "https://github.com/jackaudio/jack2-releases/releases/download/v${JackVersion}/jack2-win" @@ -150,7 +142,8 @@ Function Install-Qt Function Ensure-Qt { - if ( Test-Path -Path $QtDir ) + if ( (Test-Path -Path "$QtDir\$Qt32Version\bin\qmake.exe" -PathType Leaf) -and + (Test-Path -Path "$QtDir\$Qt64Version\bin\qmake.exe" -PathType Leaf) ) { echo "Using Qt installation from previous run (actions/cache)" return diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 2bb3add446..470a265bac 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -230,6 +230,7 @@ jobs: # Disable CodeQL on mac as it interferes with signing the binaries (signing hangs, see #2563 and #2564) run_codeql: false xcode_version: 16.3.0 + dependency_cache_key: qt6 is_main_build_target: true # Reminder: If Legacy is removed, be sure to add a dedicated job for CodeQL again. @@ -243,6 +244,7 @@ jobs: # https://developer.apple.com/support/xcode/ # https://xcodereleases.com/ xcode_version: 16.3.0 + dependency_cache_key: qt5 is_main_build_target: true - config_name: iOS (artifacts) @@ -254,12 +256,14 @@ jobs: # Therefore, disable it: run_codeql: false xcode_version: 26.2 + dependency_cache_key: ios - config_name: Windows (artifact+codeQL) target_os: windows building_on_os: windows-2025 base_command: powershell .\.github\autobuild\windows.ps1 -Stage run_codeql: true + dependency_cache_key: asio is_main_build_target: true - config_name: Windows JACK (artifact) @@ -267,6 +271,7 @@ jobs: building_on_os: windows-2025 base_command: powershell .\.github\autobuild\windows.ps1 -BuildOption jackonwindows -Stage run_codeql: false + dependency_cache_key: jack # This injects the build_all_targets information into each matrix output: build_all_targets: @@ -300,7 +305,14 @@ jobs: path: | ~/qt ~/Library/Cache/jamulus-dependencies - key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', '.github/autobuild/mac.sh', 'mac/deploy_mac.sh') }}-${{ matrix.config.base_command }} + key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/mac-dependencies.sh') }}-${{ matrix.config.dependency_cache_key }} + + - name: Cache iOS dependencies + if: matrix.config.target_os == 'ios' + uses: actions/cache@v6 + with: + path: /opt/qt + key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/ios-dependencies.sh') }}-${{ matrix.config.dependency_cache_key }} - name: Cache Windows dependencies if: matrix.config.target_os == 'windows' @@ -312,7 +324,7 @@ jobs: C:\AutobuildCache ${{ github.workspace }}\libs\NSIS\NSIS-source ${{ github.workspace }}\libs\ASIOSDK2 - key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', '.github/autobuild/windows.ps1', 'windows/deploy_windows.ps1') }}-${{ matrix.config.base_command }} + key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/windows-dependencies.ps1', 'windows/deploy_windows.ps1') }}-${{ matrix.config.dependency_cache_key }} - name: Cache Android dependencies if: matrix.config.target_os == 'android' diff --git a/.github/workflows/bump-dependencies.yml b/.github/workflows/bump-dependencies.yml index a59eca3398..564ec1b0a2 100644 --- a/.github/workflows/bump-dependencies.yml +++ b/.github/workflows/bump-dependencies.yml @@ -39,8 +39,8 @@ jobs: - name: aqt # not Changelog-worthy get_upstream_version: GH_REPO=miurahr/aqtinstall gh release view --json tagName --jq .tagName | sed -re 's/^v//' - # The following regexps capture both the *nix and the Windows variable syntax (different case, underscore): - local_version_regex: (.*AQTINSTALL_?VERSION\s*=\s*"?)([0-9.]*)("?.*) + # Capture both plain assignments and shell parameter-expansion defaults. + local_version_regex: (.*AQTINSTALL_?VERSION\s*=\s*"?[^0-9]*)([0-9.]+)(.*) - name: create-dmg changelog_name: create-dmg (macOS) get_upstream_version: GH_REPO=create-dmg/create-dmg gh release view --json tagName --jq .tagName | sed -re 's/^v//' @@ -50,8 +50,8 @@ jobs: get_upstream_version: | latest_minor="$(curl -s https://download.qt.io/official_releases/qt/ | grep -oP 'href="\K[0-9.]+(?=/")' | sort --reverse --version-sort | head -n1)"; curl -s https://download.qt.io/official_releases/qt/"${latest_minor}"/ | grep -oP 'href="\K[0-9.]+(?=/")' | sort --reverse --version-sort | head -n1 - # The following regex captures both the *nix and the Windows variable syntax (different case, underscore): - local_version_regex: (.*QT[0-9_]+VERSION\s*=\s*"?)(6\.[0-9.]+)("?.*) + # Capture both plain assignments and shell parameter-expansion defaults. + local_version_regex: (.*QT[0-9_]+VERSION\s*=\s*"?[^0-9]*)(6\.[0-9.]+)(.*) - name: jack changelog_name: bundled JACK (Windows-only)