-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autobuild: Refactor & use actions/cache #2284
Conversation
# Enable caching of downloaded dependencies | ||
- name: "Cache Mac dependencies" | ||
if: ${{ matrix.config.target_os == 'macos' }} | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
/usr/local/opt/qt | ||
~/Library/Caches/pip | ||
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', 'autobuild/mac/artifacts/autobuild_mac_1_prepare.sh', 'autobuild/mac/codeQL/autobuild_mac_1_prepare.sh') }}-${{ matrix.config.cmd1_prebuild }} | ||
|
||
- name: "Cache Windows dependencies" | ||
if: ${{ matrix.config.target_os == 'windows' }} | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
C:\Qt | ||
C:\ChocoCache | ||
~\AppData\Local\pip\Cache | ||
~\windows\NSIS | ||
~\windows\ASIOSDK2 | ||
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', 'autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1', 'windows/deploy_windows.ps1') }}-${{ matrix.config.cmd1_prebuild }} | ||
|
||
- name: "Cache Android dependencies" | ||
if: ${{ matrix.config.target_os == 'android' }} | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
/opt/Qt | ||
/opt/android/android-sdk | ||
/opt/android/android-ndk | ||
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', 'autobuild/android/autobuild_apk_1_prepare.sh', 'autobuild/android/install-qt.sh') }}-${{ matrix.config.cmd1_prebuild }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've considered making this a single step and providing the platform-specific differences (path
, key
) via the matrix config, but that would imply that we would have to duplicate all that per-instance (e.g. once for regular Windows builds, once for JACK; once for regular Mac builds, once for legacy). Therefore I decided to go this route.
f12c5b5
to
91d47e2
Compare
91d47e2
to
e8c05a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better and has lots green builds so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready to merge? Probably not yet since the artefacts haven’t been tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good
Thanks for the reviews. |
What I would feel safe with would be a merge of the refactoring-/pinning-only changes for 3.8.2. In fact, doing so would make future planned refactorings simpler so I'd like to go this path and will open a copy of this PR with just the refactoring parts. |
This commit introduces an actions/cache step for Android, Mac and Windows builds. For Linux, this makes little sense as all dependencies are installed via apt, which should be almost locally anyway (Azure apt mirror). We rely on pinned versions for the relevant external dependencies. The following environments are cached: - Qt installation directory (Windows, Mac, Android) - pip cache (Windows, Mac) - choco cache (Windows) - Android SDK & NDK (Android) The cache is used if the workflow-provided calls (which include Qt versions) are unchanged and if certain files (most notably the files that this commit touches) are unchanged. If anything changes, the cache is not used. Instead, everything starts clean and the result is cached for further reuse again. This is supposed to: - Make builds more deterministic - Speed up builds by avoiding repeated downloads and some extractions - Increase resilience against temporary external outages (e.g. Qt mirror problems)
e8c05a4
to
82761fc
Compare
Should be merged after upcoming release (not squash merged) |
@hoffie are you ok with a merge (and test during our development cycle) or is anything blocking (i.e. caching of create-dmg, the PR I merged now) |
Yes, I think that'd be best.
Should not be blocking. Brew is not explicitly part of the cache in this PR, but that's not an issue. We can extend it in a follow-up. I neither want to sneak this into this already approved PR nor go another round of approvals here. Will open a follow-up. See #2412 for tracking. |
Short description of changes
This PR introduces an actions/cache step for Android, Mac and Windows builds. For Linux, this makes little sense as all dependencies are installed via apt, which should be almost locally anyway (Azure apt mirror).
For the caching to be effective and correct, all cached versions must be pinned. This is permits the caching logic to invalidate caches automatically based on a key (script content + invocation paramters). Pinning has partly been implemented already (Qt, NSIS, ASIOSDK, Android Command Line Tools, Android NDK, Android SDK). In addition, this PR requires #2345 which introduces version pinning for JACK and aqtinstaller.
The following environments are cached:
The cache is used if the workflow-provided calls (which include Qt versions) are unchanged and if certain files (most notably autobuild.yml, prepare scripts and prepare script dependencies) are unchanged. If anything changes, the cache is not used. Instead, everything starts clean and the result is cached for further reuse again.
Goals of this PR:
Risks:
Several refactorings in the build scripts have been necessary to be able to introduce those features. Therefore, they are part of this PR. In order to keep history clean and make review easier, they have been extracted as individual commits:
Context: Fixes an issue?
Fixes #2277
Does this change need documentation? What needs to be documented and how?
No.
Status of this Pull Request
Not ready for merge. Should wait for 3.9.0.
What is missing until this pull request can be merged?
key
logicChecklist
My code follows the style guide