Skip to content

Build macOS dmg

Build macOS dmg #133

name : Build macOS dmg
on:
pull_request:
workflow_dispatch:
push:
branches:
- 'master'
- 'releases/**'
- 'testing/**'
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 50
env:
REPO: https://github.com/biolab/orange3.git
BUILD_BRANCH: master
BUILD_COMMIT: FETCH_HEAD
BUILD_LOCAL: 1
PYTHONFAULTHANDLER: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_CACHE_DIR: .pip-cache
PIP_PREFER_BINARY: 1
PIP_NO_WARN_SCRIPT_LOCATION: 1
strategy:
fail-fast: False
matrix:
include:
- os: macos-12
arch: x86_64
python-version: "3.10.11"
req: ../specs/macos/requirements.txt
app: "/Applications/Orange3.app"
- os: macos-14
arch: arm64
python-version: "3.11.8"
req: ../specs/macos/requirements-arm64.txt
app: "/Applications/Orange.app"
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Checkout orange3
shell: bash
run: |
set -e
git clone -q $REPO
cd orange3
git fetch origin $BUILD_BRANCH
git checkout $BUILD_COMMIT
- name: Setup Pip Cache
uses: actions/cache@v3
with:
path: .pip-cache
key: ${{ runner.os }}-py-${{ matrix.python-version }}-pip-${{ hashFiles('.github/workflows/build-macos-installer.yml') }}
restore-keys: |
${{ runner.os }}-py-${{ matrix.python-version }}-pip
- name: 'Install modified create-dmg (modified to allow longer detach timeouts)'
shell: bash
run: |
wget https://github.com/create-dmg/create-dmg/archive/refs/tags/v1.2.1.tar.gz
tar -zxvf v1.2.1.tar.gz
cd create-dmg-1.2.1/
patch --ignore-whitespace create-dmg <<'EOF'
--- a/create-dmg 2023-11-13 15:11:49.411364880 +0100
+++ b/create-dmg 2023-11-13 15:20:02.373043672 +0100
@@ -31,7 +31,7 @@
SANDBOX_SAFE=0
BLESS=0
SKIP_JENKINS=0
-MAXIMUM_UNMOUNTING_ATTEMPTS=3
+MAXIMUM_UNMOUNTING_ATTEMPTS=6
SIGNATURE=""
NOTARIZE=""
@@ -41,14 +41,17 @@
function hdiutil_detach_retry() {
# Unmount
+ sync --file-system "$1"
+ sleep 10
unmounting_attempts=0
until
echo "Unmounting disk image..."
(( unmounting_attempts++ ))
hdiutil detach "$1"
exit_code=$?
+ echo "hdiutil exited with $exit_code"
(( exit_code == 0 )) && break # nothing goes wrong
- (( exit_code != 16 )) && exit $exit_code # exit with the original exit code
+ #(( exit_code != 16 )) && exit $exit_code # exit with the original exit code
# The above statement returns 1 if test failed (exit_code == 16).
# It can make the code in the {do... done} block to be executed
do
EOF
sudo make install
cd ..
- name: Build application bundle
shell: bash
env:
PYTHON_VERSION: ${{ matrix.python-version }}
REQ: ${{ matrix.req }}
APP: ${{ matrix.app }}
run: |
set -e
cd orange3
if [[ $BUILD_LOCAL ]]; then
PIP_ARGS=( --pip-arg={-r,$REQ,./} );
else
PIP_ARGS=( --pip-arg={-r,$REQ,Orange3==$BUILD_COMMIT} );
fi
../scripts/macos/build-macos-app.sh "${PIP_ARGS[@]}" --python-version=${PYTHON_VERSION} "$APP"
- name: Apply arm64 specific patches
env:
APP: ${{ matrix.app }}
if: matrix.arch == 'arm64'
run: |
patch -p1 -d "$APP" < ./scripts/macos/arm64.patch
- name: Build dmg installer
shell: bash
env:
PYTHON_VERSION: ${{ matrix.python-version }}
ARCH: ${{ matrix.arch }}
APP: ${{ matrix.app }}
run: |
set -e
mkdir dist
./scripts/macos/create-dmg-installer.sh --app "$APP" dist/Orange3.dmg
VERSION=$("$APP/Contents/MacOS/pip" show orange3 | grep -E '^Version: ' | cut -d ' ' -f 2)
mv dist/Orange3.dmg dist/Orange3-$VERSION-Python${PYTHON_VERSION}-${ARCH}.dmg
shasum -a 256 dist/Orange3-$VERSION-Python${PYTHON_VERSION}-${ARCH}.dmg
- name: Upload dmg
uses: actions/upload-artifact@v4
with:
name: orange-dmg-installer-${{ matrix.arch }}
path: dist/Orange3-*.dmg
if-no-files-found: error
test:
name: Test
needs: build
strategy:
fail-fast: False
matrix:
# Repeat of above build step runner definitions
include:
- os: macos-13
arch: x86_64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Download dmg
uses: actions/download-artifact@v4
with:
name: orange-dmg-installer-${{ matrix.arch }}
- name: Mount
shell: bash
run: |
mkdir ./mnt
hdiutil attach Orange3*.dmg -noverify -noautoopen -mountpoint ./mnt
- name: Run tests
run: |
APP=( mnt/Orange*.app )
$APP/Contents/MacOS/python --version
$APP/Contents/MacOS/pip --version
$APP/Contents/MacOS/pip freeze
export ORANGE_DEPRECATIONS_ERROR=1
export PYTHONWARNINGS=module
$APP/Contents/MacOS/python -Xfaulthandler -m unittest -v Orange.tests Orange.widgets.tests