From 56bd09e903025abc13981f90b4721e1f8c4e8c84 Mon Sep 17 00:00:00 2001 From: andreasgriffin Date: Sat, 21 Dec 2024 07:45:09 +0100 Subject: [PATCH] fix checkout --- .github/workflows/build-mac-test.yml | 6 ++---- tools/build-mac/osx.spec | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-mac-test.yml b/.github/workflows/build-mac-test.yml index 493c02f..1c8b8fb 100644 --- a/.github/workflows/build-mac-test.yml +++ b/.github/workflows/build-mac-test.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: inputs: commitHash: - description: 'Enter the commit hash to build (leave empty for the latest commit)' + description: 'Enter the commit hash to build (leave empty to use the default branch or the branch that triggered the workflow)' required: false type: string buildDMG: @@ -11,7 +11,6 @@ on: required: false type: boolean - push: branches: [ "main" ] pull_request: @@ -25,8 +24,7 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 # Fetch all history for all branches and tags - # Checkout the provided commit hash or the latest commit from the default branch - ref: ${{ github.event.inputs.commitHash || 'refs/heads/main' }} + ref: ${{ github.event.inputs.commitHash || github.sha }} - name: Run build script diff --git a/tools/build-mac/osx.spec b/tools/build-mac/osx.spec index 6b37245..579ca92 100644 --- a/tools/build-mac/osx.spec +++ b/tools/build-mac/osx.spec @@ -1,5 +1,6 @@ # -*- mode: python -*- +import platform from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs from PyInstaller.building.api import COLLECT, EXE, PYZ from PyInstaller.building.build_main import Analysis @@ -7,6 +8,21 @@ from PyInstaller.building.osx import BUNDLE import sys, os + + +# Function to determine target architecture based on Python's running architecture +def get_target_arch(): + arch = platform.machine() + if arch == 'x86_64': + return 'x86_64' + elif arch in ('arm', 'arm64', 'aarch64'): + return 'arm64' + else: + return 'universal2' # Defaulting to universal for other cases (as a fallback) +target_arch = get_target_arch() +print(f"Building for {target_arch=}") + + PACKAGE_NAME='Bitcoin_Safe.app' PYPKG='bitcoin_safe' PROJECT_ROOT = os.path.abspath(".") @@ -112,7 +128,7 @@ exe = EXE( upx=True, icon=ICONS_FILE, console=False, - target_arch='arm64', # TODO investigate building 'universal2' + target_arch=target_arch, # TODO investigate building 'universal2' ) app = BUNDLE(