-
Notifications
You must be signed in to change notification settings - Fork 74
141 lines (120 loc) · 4.88 KB
/
standalone.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
name: Build standalone
on:
push:
branches:
- main
- 'v*'
tags:
- 'v*'
workflow_dispatch:
defaults:
run:
shell: bash {0}
jobs:
build_binary:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
steps:
# osx signing based on https://melatonin.dev/blog/how-to-code-sign-and-notarize-macos-audio-plugins-in-ci/
- name: Import Certificates (macOS)
uses: apple-actions/import-codesign-certs@v2
if: ${{ matrix.os == 'macos' }}
with:
p12-file-base64: ${{ secrets.DEV_ID_APP_CERT }}
p12-password: ${{ secrets.DEV_ID_APP_PASSWORD }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install jdaviz
run: pip install .[test]
- name: Install pyinstaller
run: pip install pyinstaller==5.11
- name: Create standalone binary
env:
DEVELOPER_ID_APPLICATION: ${{ secrets.DEVELOPER_ID_APPLICATION }}
run: (cd standalone; pyinstaller ./jdaviz.spec)
- name: Remove invalid files for OSX
# hopefully we can improve this in the future
# by using good hooks
# i think the issue is that we have a . in the name, there are many
# google hits on pyqt having the same issue
# and we might be able to remove it after https://github.com/pyinstaller/pyinstaller/pull/7619
# is released (pyinstaller 5.13 probably)
if: ${{ matrix.os == 'macos' }}
run: |
rm -rf standalone/dist/jdaviz.app/Contents/MacOS/skimage/.dylibs
rm -rf standalone/dist/jdaviz.app/Contents/Resources/skimage/.dylibs
- name: Codesign (OSX)
if: ${{ matrix.os == 'macos' }}
run: |
cd standalone/dist
codesign --deep --force --options=runtime --entitlements ../entitlements.plist --sign ${{ secrets.DEVELOPER_ID_APPLICATION }} --timestamp jdaviz.app
- name: Create dmg (OSX)
# if we do not call always() GHA will && with success()
if: ${{ always() && (matrix.os == 'macos') }}
# it seems ditto (not zip) should be used in combination with notarization
# see https://developer.apple.com/forums/thread/116831
# but dmg also works
# see https://github.com/glue-viz/glue-standalone-apps/blob/main/.github/workflows/build_stable.yml
run: |
rm -rf standalone/dist/jdaviz
hdiutil create -volname "Jdaviz" -srcfolder standalone/dist -ov -format UDZO standalone/dist/jdaviz.dmg
- name: Notary step + stapling (OSX)
if: ${{ matrix.os == 'macos' }}
run: |
output=$(xcrun notarytool submit standalone/dist/jdaviz.dmg --apple-id ${{ secrets.NOTARIZATION_USERNAME }} --team-id ${{ secrets.TEAM_ID }} --wait --password ${{ secrets.NOTARIZATION_PASSWORD }}) || true
echo "$output"
uuid=$(echo "$output" | awk -F '[ :]+' '/id:/ {print $3; exit}')
echo "UUID: $uuid"
if [[ $output == *"status: Accepted"* ]]; then
echo "Great, notarization succeeded, staple it!"
xcrun stapler staple standalone/dist/jdaviz.dmg
else
echo "Log output for failed notarization: $uuid"
xcrun notarytool log --apple-id ${{ secrets.NOTARIZATION_USERNAME }} --team-id ${{ secrets.TEAM_ID }} --password ${{ secrets.NOTARIZATION_PASSWORD }} $uuid || true
fi
- name: Validate app (OSX)
if: ${{ matrix.os == 'macos' }}
run: |
spctl -a -vvv -t execute standalone/dist/jdaviz.app
- name: Run jdaviz cmd in background
if: ${{ matrix.os == 'macos' }}
run: ./standalone/dist/jdaviz.app/Contents/MacOS/jdaviz-cli imviz&
- name: Run jdaviz cmd in background
if: ${{ matrix.os != 'macos' }}
run: ./standalone/dist/jdaviz/jdaviz-cli imviz&
- name: Install playwright
run: (pip install playwright; playwright install chromium)
- name: Install pytest
run: pip install pytest-playwright
- name: Wait for Voila to get online
uses: ifaxity/wait-on-action@628831cec646e6dacca502f34a6c6b46e131e51d # v1.1.0
with:
resource: tcp:8866
timeout: 60000
- name: Test standalone
run: (cd standalone; touch pytest.ini; JUPYTER_PLATFORM_DIRS=1 pytest test_standalone.py --video=on)
- name: Upload Test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}
path: standalone/test-results
- name: Upload jdaviz standalone (non-OSX)
if: ${{ always() && (matrix.os != 'macos') }}
uses: actions/upload-artifact@v3
with:
name: jdaviz-standlone-${{ matrix.os }}
path: |
standalone/dist/jdaviz
- name: Upload jdaviz standalone (OSX)
if: ${{ always() && (matrix.os == 'macos') }}
uses: actions/upload-artifact@v3
with:
name: jdaviz-standlone-${{ matrix.os }}
path: standalone/dist/jdaviz.dmg