-
Notifications
You must be signed in to change notification settings - Fork 13
184 lines (168 loc) · 5.83 KB
/
build-macos-installer.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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@v5
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@v4
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.2.tar.gz
tar -zxvf v1.2.2.tar.gz
cd create-dmg-1.2.2/
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