Skip to content

Commit 3f7be01

Browse files
committed
Externalise cache keys to prevent unneeded invalidation
1 parent dbdd71d commit 3f7be01

11 files changed

Lines changed: 113 additions & 47 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Values are consumed by ios.sh and the dependency cache key.
4+
# shellcheck disable=SC2034
5+
export AQTINSTALL_VERSION="${AQTINSTALL_VERSION:-3.3.0}"
6+
export QT_VERSION="${QT_VERSION:-5.15.2}"

.github/autobuild/ios.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@
4848

4949
set -eu
5050

51+
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
52+
readonly PROJECT_DIR
53+
# shellcheck disable=SC1091
54+
source "${PROJECT_DIR}/.github/autobuild/ios-dependencies.sh"
55+
5156
QT_DIR=/opt/qt
52-
# The following version pinnings are semi-automatically checked for
53-
# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually:
54-
AQTINSTALL_VERSION=3.3.0
5557

5658
if [[ ! ${QT_VERSION:-} =~ [0-9]+\.[0-9]+\..* ]]; then
5759
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
6365
fi
6466

6567
setup() {
66-
if [[ -d "${QT_DIR}" ]]; then
68+
if [[ -x "${QT_DIR}/${QT_VERSION}/ios/bin/qmake" ]]; then
6769
echo "Using Qt installation from previous run (actions/cache)"
6870
else
6971
echo "Installing Qt"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Values are consumed by .github/autobuild/mac.sh, mac/deploy-mac.sh and the dependency cache key.
4+
# shellcheck disable=SC2034
5+
AQTINSTALL_VERSION=3.3.0
6+
QT_VERSION=5.15.2
7+
CREATEDMG_VERSION=1.3.0
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Values are consumed by .github/autobuild/mac.sh, mac/deploy-mac.sh and the dependency cache key.
4+
# shellcheck disable=SC2034
5+
AQTINSTALL_VERSION=3.3.0
6+
QT_VERSION=6.10.2
7+
CREATEDMG_VERSION=1.3.0

.github/autobuild/mac.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@
4848

4949
set -eu
5050

51+
QT=${QT:-6}
52+
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
53+
readonly PROJECT_DIR
54+
# shellcheck disable=SC1090
55+
source "${PROJECT_DIR}/.github/autobuild/mac-dependencies_qt${QT}.sh"
56+
5157
QT_DIR=~/qt
52-
# The following version pinnings are semi-automatically checked for
53-
# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually:
54-
AQTINSTALL_VERSION=3.3.0
5558

5659
TARGET_ARCHS="${TARGET_ARCHS:-}"
5760

@@ -65,7 +68,8 @@ if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
6568
fi
6669

6770
setup() {
68-
if [[ -d "${QT_DIR}" ]]; then
71+
if [[ -x "${QT_DIR}/${QT_VERSION}/macos/bin/qmake" &&
72+
-x "${QT_DIR}/${QT_VERSION}/macos/bin/macdeployqt" ]]; then
6973
echo "Using Qt installation from previous run (actions/cache)"
7074
else
7175
echo "Installing Qt..."
@@ -194,7 +198,7 @@ build_app_as_dmg_installer() {
194198
if prepare_signing; then
195199
BUILD_ARGS=("-s" "${MACOS_CERTIFICATE_DEV_ID_APPLICATION_ID}" "-a" "${MAC_STORE_APP_CERT_ID}" "-i" "${MACOS_CERTIFICATE_INST_DISTRIBUTION_ID}" "-k" "${KEYCHAIN_PASSWORD}")
196200
fi
197-
TARGET_ARCHS="${TARGET_ARCHS}" ./mac/deploy_mac.sh "${BUILD_ARGS[@]}"
201+
QT=${QT} TARGET_ARCHS="${TARGET_ARCHS}" ./mac/deploy_mac.sh "${BUILD_ARGS[@]}"
198202
}
199203

200204
pass_artifact_to_job() {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# The following version pinnings are semi-automatically checked for updates.
2+
# Verify .github/workflows/bump-dependencies.yaml when changing those manually:
3+
4+
# Values are consumed by .github/autobuild/windows.ps1, windows/deploy_windows.ps2 and the dependency cache key.
5+
$Qt32Version = "5.15.2"
6+
$Qt64Version = "6.10.2"
7+
$QtCompile32 = "msvc2019"
8+
$QtCompile64 = "msvc2022"
9+
$AqtinstallVersion = "3.3.0"
10+
$JackVersion = "1.9.22"
11+
$JomVersion = "1.1.2"
12+
13+
# Important:
14+
# - Do not update ASIO SDK without checking for license-related changes.
15+
# - Do not copy (parts of) the ASIO SDK into the Jamulus source tree without
16+
# further consideration as it would make the license situation more complicated.
17+
$AsioSDKVersion = "2.3.4_2025-10-15"
18+
19+
$NsisVersion = "3.12"

.github/autobuild/windows.ps1

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,11 @@ $ProgressPreference = 'SilentlyContinue'
6868
$QtDir = 'C:\Qt'
6969
$ChocoCacheDir = 'C:\ChocoCache'
7070
$DownloadCacheDir = 'C:\AutobuildCache'
71-
# The following version pinnings are semi-automatically checked for
72-
# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually:
73-
$Qt32Version = "5.15.2"
74-
$Qt64Version = "6.10.2"
75-
$AqtinstallVersion = "3.3.0"
76-
$JackVersion = "1.9.22"
77-
$Msvc32Version = "win32_msvc2019"
78-
$Msvc64Version = "win64_msvc2022_64"
79-
$JomVersion = "1.1.2"
71+
$DependencySuffix = ''
72+
. "$PSScriptRoot\windows-dependencies.ps1"
73+
74+
$Msvc32Version = "win32_${QtCompile32}"
75+
$Msvc64Version = "win64_${QtCompile64}_64"
8076

8177
# Compose JACK download urls
8278
$JackBaseUrl = "https://github.com/jackaudio/jack2-releases/releases/download/v${JackVersion}/jack2-win"
@@ -150,7 +146,8 @@ Function Install-Qt
150146

151147
Function Ensure-Qt
152148
{
153-
if ( Test-Path -Path $QtDir )
149+
if ( (Test-Path -Path "$QtDir\$Qt32Version\bin\qmake.exe" -PathType Leaf) -and
150+
(Test-Path -Path "$QtDir\$Qt64Version\bin\qmake.exe" -PathType Leaf) )
154151
{
155152
echo "Using Qt installation from previous run (actions/cache)"
156153
return

.github/workflows/autobuild.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,23 +226,25 @@ jobs:
226226
- config_name: MacOS (artifacts)
227227
target_os: macos
228228
building_on_os: macos-15
229-
base_command: QT_VERSION=6.10.2 SIGN_IF_POSSIBLE=1 TARGET_ARCHS="x86_64 arm64" ./.github/autobuild/mac.sh
229+
base_command: QT=6 SIGN_IF_POSSIBLE=1 TARGET_ARCHS="x86_64 arm64" ./.github/autobuild/mac.sh
230230
# Disable CodeQL on mac as it interferes with signing the binaries (signing hangs, see #2563 and #2564)
231231
run_codeql: false
232232
xcode_version: 16.3.0
233+
dependency_cache_key: qt6
233234
is_main_build_target: true
234235

235236
# Reminder: If Legacy is removed, be sure to add a dedicated job for CodeQL again.
236237
- config_name: MacOS Legacy (artifacts+CodeQL)
237238
target_os: macos
238239
building_on_os: macos-15-intel
239-
base_command: QT_VERSION=5.15.2 SIGN_IF_POSSIBLE=0 ARTIFACT_SUFFIX=_legacy ./.github/autobuild/mac.sh
240+
base_command: QT=5 SIGN_IF_POSSIBLE=0 ARTIFACT_SUFFIX=_legacy ./.github/autobuild/mac.sh
240241
# Enable CodeQL on mac legacy as this version does not get signed
241242
run_codeql: true
242243
# macos-15-intel ships with Xcode 16.x; while Qt5 is older, Xcode 16 still supports building it
243244
# https://developer.apple.com/support/xcode/
244245
# https://xcodereleases.com/
245246
xcode_version: 16.3.0
247+
dependency_cache_key: qt5
246248
is_main_build_target: true
247249

248250
- config_name: iOS (artifacts)
@@ -254,19 +256,22 @@ jobs:
254256
# Therefore, disable it:
255257
run_codeql: false
256258
xcode_version: 26.2
259+
dependency_cache_key: ios
257260

258261
- config_name: Windows (artifact+codeQL)
259262
target_os: windows
260263
building_on_os: windows-2025
261264
base_command: powershell .\.github\autobuild\windows.ps1 -Stage
262265
run_codeql: true
266+
dependency_cache_key: asio
263267
is_main_build_target: true
264268

265269
- config_name: Windows JACK (artifact)
266270
target_os: windows
267271
building_on_os: windows-2025
268272
base_command: powershell .\.github\autobuild\windows.ps1 -BuildOption jackonwindows -Stage
269273
run_codeql: false
274+
dependency_cache_key: jack
270275

271276
# This injects the build_all_targets information into each matrix output:
272277
build_all_targets:
@@ -294,13 +299,29 @@ jobs:
294299
fetch-depth: ${{ matrix.config.checkout_fetch_depth || '1' }}
295300

296301
- name: Cache Mac dependencies
297-
if: matrix.config.target_os == 'macos'
302+
if: matrix.config.target_os == 'macos' && matrix.config.dependency_cache_key == 'qt6'
298303
uses: actions/cache@v6
299304
with:
300305
path: |
301306
~/qt
302307
~/Library/Cache/jamulus-dependencies
303-
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', '.github/autobuild/mac.sh', 'mac/deploy_mac.sh') }}-${{ matrix.config.base_command }}
308+
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/mac-dependencies_qt6.sh') }}-${{ matrix.config.dependency_cache_key }}
309+
310+
- name: Cache Mac Legacy dependencies
311+
if: matrix.config.target_os == 'macos' && matrix.config.dependency_cache_key == 'qt5'
312+
uses: actions/cache@v6
313+
with:
314+
path: |
315+
~/qt
316+
~/Library/Cache/jamulus-dependencies
317+
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/mac-dependencies_qt5.sh') }}-${{ matrix.config.dependency_cache_key }}
318+
319+
- name: Cache iOS dependencies
320+
if: matrix.config.target_os == 'ios'
321+
uses: actions/cache@v6
322+
with:
323+
path: /opt/qt
324+
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/ios-dependencies.sh') }}-${{ matrix.config.dependency_cache_key }}
304325

305326
- name: Cache Windows dependencies
306327
if: matrix.config.target_os == 'windows'
@@ -312,7 +333,7 @@ jobs:
312333
C:\AutobuildCache
313334
${{ github.workspace }}\libs\NSIS\NSIS-source
314335
${{ github.workspace }}\libs\ASIOSDK2
315-
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', '.github/autobuild/windows.ps1', 'windows/deploy_windows.ps1') }}-${{ matrix.config.base_command }}
336+
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/autobuild/windows-dependencies.ps1') }}-${{ matrix.config.dependency_cache_key }}
316337

317338
- name: Cache Android dependencies
318339
if: matrix.config.target_os == 'android'
@@ -359,6 +380,7 @@ jobs:
359380
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
360381
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
361382
MACOS_CA_PUBLICKEY: ${{ secrets.MACOS_CA_PUBKEY }}
383+
362384
- name: Post-Build for ${{ matrix.config.config_name }}
363385
id: get-artifacts
364386
run: ${{ matrix.config.base_command }} get-artifacts

.github/workflows/bump-dependencies.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,24 @@ jobs:
3636
fail-fast: false
3737
matrix:
3838
components:
39+
3940
- name: aqt
4041
# not Changelog-worthy
4142
get_upstream_version: GH_REPO=miurahr/aqtinstall gh release view --json tagName --jq .tagName | sed -re 's/^v//'
42-
# The following regexps capture both the *nix and the Windows variable syntax (different case, underscore):
43-
local_version_regex: (.*AQTINSTALL_?VERSION\s*=\s*"?)([0-9.]*)("?.*)
43+
# Capture both plain assignments and shell parameter-expansion defaults.
44+
local_version_regex: (AQTINSTALL_VERSION=)([0-9.]+)(.*)
45+
4446
- name: create-dmg
4547
changelog_name: create-dmg (macOS)
4648
get_upstream_version: GH_REPO=create-dmg/create-dmg gh release view --json tagName --jq .tagName | sed -re 's/^v//'
47-
local_version_regex: (.*CREATEDMG_VERSION\s*=\s*"?)([0-9.]*)("?.*)
49+
local_version_regex: (CREATEDMG_VERSION=)([0-9.]+)(.*)
50+
4851
- name: Qt6
4952
changelog_name: bundled Qt6
5053
get_upstream_version: |
5154
latest_minor="$(curl -s https://download.qt.io/official_releases/qt/ | grep -oP 'href="\K[0-9.]+(?=/")' | sort --reverse --version-sort | head -n1)";
5255
curl -s https://download.qt.io/official_releases/qt/"${latest_minor}"/ | grep -oP 'href="\K[0-9.]+(?=/")' | sort --reverse --version-sort | head -n1
53-
# The following regex captures both the *nix and the Windows variable syntax (different case, underscore):
54-
local_version_regex: (.*QT[0-9_]+VERSION\s*=\s*"?)(6\.[0-9.]+)("?.*)
56+
local_version_regex: (QT[0-9_]+VERSION\s*=\s*"?[^0-9]*)(6\.[0-9.]+)(.*)
5557

5658
- name: jack
5759
changelog_name: bundled JACK (Windows-only)
@@ -73,14 +75,14 @@ jobs:
7375
# This pattern is a bit special as it has to match twice in a single line.
7476
# Therefore, we have to be very careful to avoid consuming too much pattern space.
7577
# This is why a positive lookahead is used instead of direct matching:
76-
local_version_regex: (.*"nsis-|.*\/NSIS.20.\/|\/nsis-)([0-9.]+)(".*|(?=\/nsis-)|\.zip.*)
78+
local_version_regex: (.*NsisVersion = ")([0-9.]+)(".*)
7779

7880
- name: ASIO-SDK
7981
changelog_name: ASIO SDK (Windows-only)
8082
get_upstream_version: |
8183
curl -s -o /dev/null --location --range 0-5 --write-out '%{url_effective}' https://www.steinberg.net/asiosdk |
8284
grep -oP '.*\K(?:ASIO-SDK|asiosdk)_.*(?=\.zip)'
83-
local_version_regex: (.*["\/])((?:ASIO-SDK|asiosdk)_[^"]+?)(".*|\.zip.*)
85+
local_version_regex: (.*AsioSDKVersion = ")([0-9]+_([0-9-]+))(".*)
8486

8587
steps:
8688
- uses: actions/checkout@v7
@@ -91,7 +93,7 @@ jobs:
9193
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9294
run: |
9395
set -eu
94-
files=( .github/{autobuild,workflows}/* windows/*.ps1 mac/*.sh )
96+
files=( .github/autobuild/*-dependencies.* )
9597
upstream_version="$(${{ matrix.components.get_upstream_version }})"
9698
local_version="$(perl -nle 'print "$2" if /${{ matrix.components.local_version_regex }}/i' "${files[@]}" | sort --reverse --version-sort | head -n1)"
9799
if [[ -z "$upstream_version" ]]; then

mac/deploy_mac.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@
4747
##############################################################################
4848
set -eu -o pipefail
4949

50+
QT=${QT:-6}
5051
# Dependency versions
51-
CREATEDMG_VERSION="1.3.0"
52+
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
53+
readonly PROJECT_DIR
54+
# shellcheck disable=SC1090
55+
source "${PROJECT_DIR}/.github/autobuild/mac-dependencies_qt${QT}.sh"
5256

5357
root_path=$(pwd)
5458
project_path="${root_path}/Jamulus.pro"

0 commit comments

Comments
 (0)