Switch Filter Coverage button to switch #65
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 standalone | |
on: | |
push: | |
branches: | |
- main | |
- 'v*' | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize, labeled, unlabeled] | |
defaults: | |
run: | |
shell: bash {0} | |
jobs: | |
build_binary_not_osx: | |
runs-on: ${{ matrix.os }}-latest | |
if: (github.repository == 'spacetelescope/jdaviz' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build standalone'))) | |
strategy: | |
matrix: | |
os: [ubuntu, windows] | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
with: | |
python-version: "3.11" | |
- name: Install jdaviz | |
run: pip install .[test] | |
- name: Install pyinstaller | |
run: pip install "pyinstaller<6" | |
- name: Create standalone binary | |
env: | |
DEVELOPER_ID_APPLICATION: ${{ secrets.DEVELOPER_ID_APPLICATION }} | |
run: (cd standalone; pyinstaller ./jdaviz.spec) | |
- name: Run jdaviz cmd in background | |
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 Solara to get online | |
uses: ifaxity/wait-on-action@a7d13170ec542bdca4ef8ac4b15e9c6aa00a6866 # v1.2.1 | |
with: | |
resource: tcp:8765 | |
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: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: test-results-${{ matrix.os }} | |
path: standalone/test-results | |
- name: Upload jdaviz standalone (non-OSX) | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: jdaviz-standlone-${{ matrix.os }} | |
path: | | |
standalone/dist/jdaviz | |
# Do not want to deal with OSX certs in pull request builds. | |
build_binary_osx: | |
runs-on: ${{ matrix.os }}-latest | |
if: (github.repository == 'spacetelescope/jdaviz' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')) | |
strategy: | |
matrix: | |
os: [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@63fff01cd422d4b7b855d40ca1e9d34d2de9427d # v3 | |
if: ${{ matrix.os == 'macos' }} | |
with: | |
p12-file-base64: ${{ secrets.DEV_ID_APP_CERT }} | |
p12-password: ${{ secrets.DEV_ID_APP_PASSWORD }} | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
with: | |
python-version: "3.11" | |
- name: Install jdaviz | |
run: pip install .[test] | |
- name: Install pyinstaller | |
run: pip install "pyinstaller<6" | |
- 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 | |
rm -rf standalone/dist/jdaviz.app/Contents/MacOS/shapely/.dylibs | |
rm -rf standalone/dist/jdaviz.app/Contents/Resources/shapely/.dylibs | |
rm -rf standalone/dist/jdaviz.app/Contents/MacOS/scipy/.dylibs | |
rm -rf standalone/dist/jdaviz.app/Contents/Resources/scipy/.dylibs | |
rm -rf standalone/dist/jdaviz.app/Contents/Resources/scipy/special/*.dylib | |
- 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: Install playwright | |
run: (pip install playwright; playwright install chromium) | |
- name: Install pytest | |
run: pip install pytest-playwright | |
- name: Wait for Solara to get online | |
uses: ifaxity/wait-on-action@a7d13170ec542bdca4ef8ac4b15e9c6aa00a6866 # v1.2.1 | |
with: | |
resource: tcp:8765 | |
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: test-results-${{ matrix.os }} | |
path: standalone/test-results | |
- name: Upload jdaviz standalone (OSX) | |
if: ${{ always() && (matrix.os == 'macos') }} | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: jdaviz-standlone-${{ matrix.os }} | |
path: standalone/dist/jdaviz.dmg |