Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/autobuild/get_build_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import os
import re
import subprocess
import hashlib

REPO_PATH = os.path.join(os.path.dirname(__file__), '..', '..')

Expand Down Expand Up @@ -74,6 +75,15 @@ def set_github_variable(varname, varval):
with open(output_file, "a") as ghout:
ghout.write(f"{varname}={varval}\n")

def hash_files(file_list):
key = hashlib.sha256()
mem = memoryview(bytearray(128*1024))
for file_name in file_list:
with open(file_name, 'rb', buffering=0) as f:
while n := f.readinto(mem):
key.update(mem[:n])
return key.hexdigest()

jamulus_pro_version = get_version_from_jamulus_pro()
set_github_variable("JAMULUS_PRO_VERSION", jamulus_pro_version)
build_type, build_version = get_build_version(jamulus_pro_version)
Expand Down Expand Up @@ -103,3 +113,7 @@ def set_github_variable(varname, varval):
set_github_variable("IS_PRERELEASE", str(is_prerelease).lower())
set_github_variable("RELEASE_TITLE", release_title)
set_github_variable("RELEASE_TAG", release_tag)

set_github_variable("CACHE_KEY_MACOS", hash_files([REPO_PATH + '/.github/workflows/autobuild.yml', REPO_PATH + '/.github/autobuild/mac.sh', REPO_PATH + '/mac/deploy_mac.sh']) )
set_github_variable("CACHE_KEY_WINDOWS", hash_files([REPO_PATH + '/.github/workflows/autobuild.yml', REPO_PATH + '/.github/autobuild/windows.ps1', REPO_PATH + '/windows/deploy_windows.ps1']) )
set_github_variable("CACHE_KEY_ANDROID", hash_files([REPO_PATH + '/.github/workflows/autobuild.yml', REPO_PATH + '/.github/autobuild/android.sh']) )
9 changes: 6 additions & 3 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
publish_to_release: ${{ steps.get-build-vars.outputs.PUBLISH_TO_RELEASE }}
tag_name: ${{ steps.get-build-vars.outputs.RELEASE_TAG }}
build_version: ${{ steps.get-build-vars.outputs.BUILD_VERSION }}
cache_key_macos: ${{ steps.get-build-vars.outputs.CACHE_KEY_MACOS }}
cache_key_windows: ${{ steps.get-build-vars.outputs.CACHE_KEY_WINDOWS }}
cache_key_android: ${{ steps.get-build-vars.outputs.CACHE_KEY_ANDROID }}
build_all_targets: ${{ steps.decide-build-targets.outputs.build_all_targets }}
env:
release_changelog_path: ./.github_release_changelog.md
Expand Down Expand Up @@ -323,7 +326,7 @@ 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 }}-${{ needs.create_release.outputs.cache_key_macos }}-${{ matrix.config.base_command }}

- name: Cache Windows dependencies
if: matrix.config.target_os == 'windows'
Expand All @@ -335,7 +338,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 }}-${{ needs.create_release.outputs.cache_key_windows }}-${{ matrix.config.base_command }}

- name: Cache Android dependencies
if: matrix.config.target_os == 'android'
Expand All @@ -345,7 +348,7 @@ jobs:
/opt/Qt
/opt/android/android-sdk
/opt/android/android-ndk
key: ${{ matrix.config.target_os }}-${{ hashFiles('.github/workflows/autobuild.yml', '.github/autobuild/android.sh') }}-${{ matrix.config.base_command }}
key: ${{ matrix.config.target_os }}-${{ needs.create_release.outputs.cache_key_android }}-${{ matrix.config.base_command }}

- name: Set up build dependencies for ${{ matrix.config.config_name }}
run: ${{ matrix.config.base_command }} setup
Expand Down