build-macos-installer.yml: Patch create-dmg #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name : Build macOS dmg | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'releases/**' | |
- 'testing/**' | |
jobs: | |
build: | |
runs-on: macos-11 | |
timeout-minutes: 50 | |
env: | |
REPO: https://github.com/biolab/orange3.git | |
BUILD_BRANCH: master | |
BUILD_COMMIT: FETCH_HEAD | |
BUILD_LOCAL: 1 | |
APP: "/Applications/Orange3.app" | |
PYTHONFAULTHANDLER: 1 | |
PIP_NO_PIP_VERSION_CHECK: 1 | |
PIP_CACHE_DIR: .pip-cache | |
PIP_PREFER_BINARY: 1 | |
strategy: | |
fail-fast: False | |
matrix: | |
include: | |
- python-version: 3.9.12 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- 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,6 +41,8 @@ | |
function hdiutil_detach_retry() { | |
# Unmount | |
+ sync --file-system "$1" | |
+ sleep 10 | |
unmounting_attempts=0 | |
until | |
echo "Unmounting disk image..." | |
EOF | |
make install | |
cd .. | |
- name: Build application bundle | |
shell: bash | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
run: | | |
set -e | |
cd orange3 | |
if [[ $BUILD_LOCAL ]]; then | |
PIP_ARGS=( --pip-arg={-r,../specs/macos/requirements.txt,./} ); | |
else | |
PIP_ARGS=( --pip-arg={-r,../specs/macos/requirements.txt,Orange3==$BUILD_COMMIT} ); | |
fi | |
../scripts/macos/build-macos-app.sh "${PIP_ARGS[@]}" --python-version=${PYTHON_VERSION} "$APP" | |
- name: Build dmg installer | |
shell: bash | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
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}.dmg | |
shasum -a 256 dist/Orange3-$VERSION-Python${PYTHON_VERSION}.dmg | |
- name: Upload dmg | |
uses: actions/upload-artifact@v3 | |
with: | |
name: orange-dmg-installer | |
path: dist/Orange3-*.dmg | |
if-no-files-found: error | |
test: | |
name: Test | |
needs: build | |
runs-on: macos-latest | |
steps: | |
- name: Download dmg | |
uses: actions/download-artifact@v3 | |
with: | |
name: orange-dmg-installer | |
- name: Mount | |
shell: bash | |
run: | | |
mkdir ./mnt | |
hdiutil attach Orange3*.dmg -noverify -noautoopen -mountpoint ./mnt | |
- name: Run tests | |
run: | | |
APP=( mnt/Orange3.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 |