Skip to content

Commit 6c53790

Browse files
committed
Externalise cache keys to prevent unneeded invalidation
1 parent 4a43f6f commit 6c53790

12 files changed

Lines changed: 140 additions & 67 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# The following version pinnings are semi-automatically checked for updates.
3+
# Verify .github/workflows/bump-dependencies.yml when changing those manually:
4+
5+
# Values are consumed by ios.sh and the dependency cache key.
6+
# shellcheck disable=SC2034
7+
AQTINSTALL_VERSION=3.3.0
8+
QT_VERSION=5.15.2

.github/autobuild/ios.sh

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

4949
set -eu
5050

51-
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
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+
56+
QT_DIR=${HOME}/qt
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,13 +65,13 @@ if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
6365
fi
6466

6567
setup() {
66-
if [[ -d "${QT_DIR}" ]]; then
68+
# We may need to create the Qt installation directory and chown it to the runner user to fix permissions
69+
sudo mkdir -p "${QT_DIR}"
70+
sudo chown -R "$(whoami)" "${QT_DIR}"
71+
if [[ -x "${QT_DIR}/${QT_VERSION}/ios/bin/qmake" ]]; then
6772
echo "Using Qt installation from previous run (actions/cache)"
6873
else
6974
echo "Installing Qt"
70-
# We may need to create the Qt installation directory and chown it to the runner user to fix permissions
71-
sudo mkdir -p "${QT_DIR}"
72-
sudo chown "$(whoami)" "${QT_DIR}"
7375
# Create and enter virtual environment
7476
python3 -m venv venv
7577
# Must hide directory as it just gets created during execution of the previous command and cannot be found by shellcheck
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# The following version pinnings are semi-automatically checked for updates.
3+
# Verify .github/workflows/bump-dependencies.yml when changing those manually:
4+
5+
# Values are consumed by .github/autobuild/mac.sh, mac/deploy_mac.sh and the dependency cache key.
6+
# shellcheck disable=SC2034
7+
AQTINSTALL_VERSION=3.3.0
8+
QT_VERSION=5.15.2
9+
CREATEDMG_VERSION=1.3.0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# The following version pinnings are semi-automatically checked for updates.
3+
# Verify .github/workflows/bump-dependencies.yml when changing those manually:
4+
5+
# Values are consumed by .github/autobuild/mac.sh, mac/deploy_mac.sh and the dependency cache key.
6+
# shellcheck disable=SC2034
7+
AQTINSTALL_VERSION=3.3.0
8+
QT_VERSION=6.10.2
9+
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.yml when changing those manually:
3+
4+
# Values are consumed by .github/autobuild/windows.ps1, windows/deploy_windows.ps1 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 = "ASIO-SDK_2.3.4_2025-10-15"
18+
19+
$NsisVersion = "3.12"

.github/autobuild/windows.ps1

Lines changed: 10 additions & 13 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 = "${QtCompile32}"
75+
$Msvc64Version = "${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\${Msvc32Version}\bin\qmake.exe" -PathType Leaf) -and
150+
(Test-Path -Path "$QtDir\$Qt64Version\${Msvc64Version}\bin\qmake.exe" -PathType Leaf) )
154151
{
155152
echo "Using Qt installation from previous run (actions/cache)"
156153
return
@@ -165,10 +162,10 @@ Function Ensure-Qt
165162
}
166163

167164
echo "Get Qt 64 bit..."
168-
Install-Qt "${Qt64Version}" "${Msvc64Version}"
165+
Install-Qt "${Qt64Version}" "win64_${Msvc64Version}"
169166

170167
echo "Get Qt 32 bit..."
171-
Install-Qt "${Qt32Version}" "${Msvc32Version}"
168+
Install-Qt "${Qt32Version}" "win32_${Msvc32Version}"
172169
}
173170

174171
Function Ensure-jom
@@ -238,7 +235,7 @@ Function Build-App-With-Installer
238235
{
239236
$ExtraArgs += ("-BuildOption", $BuildOption)
240237
}
241-
powershell ".\windows\deploy_windows.ps1" "C:\Qt\${Qt32Version}" "C:\Qt\${Qt64Version}" @ExtraArgs
238+
powershell ".\windows\deploy_windows.ps1" @ExtraArgs
242239
if ( !$? )
243240
{
244241
throw "deploy_windows.ps1 failed with exit code $LastExitCode"

.github/workflows/autobuild.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,47 +226,52 @@ 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)
249251
target_os: ios
250252
building_on_os: macos-15
251-
base_command: QT_VERSION=5.15.2 ./.github/autobuild/ios.sh
253+
base_command: ./.github/autobuild/ios.sh
252254
# Build failed with CodeQL enabled when last tested 03/2022 (#2490).
253255
# There are no hints that iOS is supposed to be supported by CodeQL.
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: ~/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: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,50 @@ 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=|\$AqtinstallVersion = \")([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_VERSION=|\$Qt64Version = \")(6\.[0-9.]+)(|\")$
5557

5658
- name: jack
5759
changelog_name: bundled JACK (Windows-only)
5860
get_upstream_version: GH_REPO=jackaudio/jack2-releases gh release view --json tagName --jq .tagName | sed -re 's/^v//'
59-
local_version_regex: (.*JackVersion\s*=\s*"?)([0-9.]+)("?.*)
61+
local_version_regex: ^(\$JackVersion = \")([^"]+)(\")$
6062

6163
- name: choco-jom
6264
# not Changelog-worthy
6365
get_upstream_version: |
6466
curl -sL "https://community.chocolatey.org/api/v2/FindPackagesById()?id='jom'" |
6567
grep -oP '(?<=<d:Version>)[^<]+' | sort --version-sort | tail -n1
66-
local_version_regex: (.*JomVersion\s*=\s*"?)([0-9.]+)("?.*)
68+
local_version_regex: ^(\$JomVersion = \")([^"]+)(\")$
6769

6870
- name: NSIS
6971
changelog_name: Windows Installer base (NSIS)
7072
get_upstream_version: |
7173
curl -s -o /dev/null --location --range 0-5 --write-out '%{url_effective}' https://sourceforge.net/projects/nsis/files/latest/download |
7274
grep -oP '.*/nsis-\K[0-9.]+(?=-setup\.)'
73-
# This pattern is a bit special as it has to match twice in a single line.
74-
# Therefore, we have to be very careful to avoid consuming too much pattern space.
75-
# This is why a positive lookahead is used instead of direct matching:
76-
local_version_regex: (.*"nsis-|.*\/NSIS.20.\/|\/nsis-)([0-9.]+)(".*|(?=\/nsis-)|\.zip.*)
75+
local_version_regex: ^(\$NsisVersion = \")([^"]+)(\")$
7776

7877
- name: ASIO-SDK
7978
changelog_name: ASIO SDK (Windows-only)
8079
get_upstream_version: |
8180
curl -s -o /dev/null --location --range 0-5 --write-out '%{url_effective}' https://www.steinberg.net/asiosdk |
8281
grep -oP '.*\K(?:ASIO-SDK|asiosdk)_.*(?=\.zip)'
83-
local_version_regex: (.*["\/])((?:ASIO-SDK|asiosdk)_[^"]+?)(".*|\.zip.*)
82+
local_version_regex: ^(\$AsioSDKVersion = \")([^"]+)(\")$
8483

8584
steps:
8685
- uses: actions/checkout@v7
@@ -91,9 +90,12 @@ jobs:
9190
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9291
run: |
9392
set -eu
94-
files=( .github/{autobuild,workflows}/* windows/*.ps1 mac/*.sh )
93+
files=( .github/autobuild/*-dependencies{,_qt[56]}.* )
94+
echo "files: (${files[@]})"
9595
upstream_version="$(${{ matrix.components.get_upstream_version }})"
96-
local_version="$(perl -nle 'print "$2" if /${{ matrix.components.local_version_regex }}/i' "${files[@]}" | sort --reverse --version-sort | head -n1)"
96+
echo "upstream version: {${upstream_version}}"
97+
local_version="$(perl -nle 'print "$2" if /${{ matrix.components.local_version_regex }}/' "${files[@]}" | sort --reverse --version-sort | head -n1)"
98+
echo "local version: {${local_version}}"
9799
if [[ -z "$upstream_version" ]]; then
98100
echo "failed to extract upstream version"
99101
exit 1
@@ -106,7 +108,7 @@ jobs:
106108
echo "upstream ${{ matrix.components.name }} (${upstream_version}) matches local ${{ matrix.components.name }} (${local_version})"
107109
exit 0
108110
fi
109-
echo "upstream ${{ matrix.components.name }} (${upstream_version}) is different than local ${{ matrix.components.name }} (${local_version}), creating PR"
111+
echo "upstream ${{ matrix.components.name }} (${upstream_version}) does not match local ${{ matrix.components.name }} (${local_version}), creating PR"
110112
git config --global user.email "actions@github.com"
111113
git config --global user.name "github-actions[bot]"
112114
pr_branch=ci/bump-dependencies/${{ matrix.components.name }}

0 commit comments

Comments
 (0)