Skip to content

Commit

Permalink
Merge branch 'main' into SlicerExtension_1344
Browse files Browse the repository at this point in the history
  • Loading branch information
rozyczko committed Jan 18, 2024
2 parents f29ef5c + cc09ed0 commit 36d0918
Show file tree
Hide file tree
Showing 362 changed files with 10,493 additions and 4,555 deletions.
124 changes: 44 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: CI

on:
[push, pull_request]
workflow_call:
pull_request:
push:
branches: [main]
tags: ['v*']

defaults:
run:
Expand All @@ -25,14 +29,19 @@ jobs:

runs-on: ubuntu-latest

# Stop existing workflows for matching branches and pull requests
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

outputs:
matrix-json: ${{ steps.set-matrix.outputs.matrix }}

steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- uses: actions/checkout@v3
- id: set-matrix
Expand Down Expand Up @@ -72,7 +81,7 @@ jobs:
- name: Install X11 libraries (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils xvfb
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils xvfb libegl-dev
- name: Install Python dependencies
run: |
Expand Down Expand Up @@ -158,16 +167,16 @@ jobs:
run: |
python -m pytest -v -s test
- name: Test GUI (Linux)
if: ${{ matrix.tests && matrix.os == 'ubuntu-latest' }}
env:
PYOPENCL_COMPILER_OUTPUT: 1
run: |
# Suppress SIGSEGV from the tests until they can be fixed
retval=0
xvfb-run -a --server-args="-screen 0 1600x900x24" python -m pytest -rsx -v src/sas/qtgui/ || retval=$?
if [ $retval -eq 139 ]; then echo "WARNING: Python interpreter exited with Segmentation Fault. This normally indicates that Qt objects were not correctly deleted. This error is currently suppressed in SasView's test suite."; retval=0; fi
exit $retval
# - name: Test GUI (Linux)
# if: ${{ matrix.tests && matrix.os == 'ubuntu-latest' }}
# env:
# PYOPENCL_COMPILER_OUTPUT: 1
# run: |
# # Suppress SIGSEGV from the tests until they can be fixed
# retval=0
# xvfb-run -a --server-args="-screen 0 1600x900x24" python -m pytest -rsx -v src/sas/qtgui/ || retval=$?
# if [ $retval -eq 139 ]; then echo "WARNING: Python interpreter exited with Segmentation Fault. This normally indicates that Qt objects were not correctly deleted. This error is currently suppressed in SasView's test suite."; retval=0; fi
# exit $retval

### Build documentation (if enabled)

Expand Down Expand Up @@ -195,7 +204,7 @@ jobs:
- name: Install utilities to build installer
if: ${{ matrix.installer }}
run: |
python -m pip install pyinstaller==5.7.0
python -m pip install pyinstaller==5.13.2
- name: Build sasview with pyinstaller
if: ${{ matrix.installer }}
Expand All @@ -217,17 +226,31 @@ jobs:
iscc installers/installer.iss
mv installers/Output/setupSasView.exe installers/dist
- name: Build sasview installer dmg file (OSX)
- name: Sign executable and create dmg (OSX)
if: ${{ matrix.installer && startsWith(matrix.os, 'macos') }}
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p DloaAcYP build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p DloaAcYP build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k DloaAcYP build.keychain
cd installers/dist
hdiutil create SasView5.dmg -srcfolder SasView5.app -ov -format UDZO
python ../../build_tools/fix_qt_folder_names_for_codesign.py SasView6.app
python ../../build_tools/code_sign_osx.py
codesign --verify --options=runtime --entitlements ../../build_tools/entitlements.plist --timestamp --deep --verbose=4 --force --sign "Developer ID Application: European Spallation Source Eric (W2AG9MPZ43)" SasView6.app
hdiutil create SasView6.dmg -srcfolder SasView6.app -ov -format UDZO
codesign -s "Developer ID Application: European Spallation Source Eric (W2AG9MPZ43)" SasView6.dmg
- name: Build sasview installer tarball (Linux)
if: ${{ matrix.installer && startsWith(matrix.os, 'ubuntu') }}
run: |
cd installers/dist
tar zcf sasview5.tar.gz sasview
tar zcf sasview6.tar.gz sasview
- name: Collect a debug tarball of the installer package
if: ${{ matrix.installer }}
Expand All @@ -238,84 +261,25 @@ jobs:
installers/dist/sasview-pyinstaller-dist.tar.gz
if-no-files-found: ignore

- name: Sign executable and create dmg (OSX)
if: ${{ matrix.installer && startsWith(matrix.os, 'macos') }}
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p DloaAcYP build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p DloaAcYP build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k DloaAcYP build.keychain
cd installers/dist
python ../../build_tools/fix_qt_folder_names_for_codesign.py SasView5.app
python ../../build_tools/code_sign_osx.py
codesign --verify --options=runtime --entitlements ../../build_tools/entitlements.plist --timestamp --deep --verbose=4 --force --sign "Developer ID Application: European Spallation Source Eric (W2AG9MPZ43)" SasView5.app
hdiutil create SasView5.dmg -srcfolder SasView5.app -ov -format UDZO
codesign -s "Developer ID Application: European Spallation Source Eric (W2AG9MPZ43)" SasView5.dmg
- name: Publish installer package
if: ${{ matrix.installer }}
uses: actions/upload-artifact@v3
with:
name: SasView-Installer-${{ matrix.os }}-${{ matrix.python-version }}
path: |
installers/dist/setupSasView.exe
installers/dist/SasView5.dmg
installers/dist/sasview5.tar.gz
installers/dist/SasView6.dmg
installers/dist/sasview6.tar.gz
if-no-files-found: error


# - name: Notarize Release Build (OSX)
# if: ${{ env.RELEASE == 'true' && matrix.installer && startsWith(matrix.os, 'macos') }}
# uses: devbotsxyz/xcode-notarize@v1
# with:
# product-path: "installers/dist/SasView5.dmg"
# primary-bundle-id: "org.sasview.SasView5"
# appstore-connect-username: ${{ secrets.NOTARIZATION_USERNAME }}
# appstore-connect-password: ${{ secrets.NOTARIZATION_PASSWORD }}

# - name: Staple Release Build (OSX)
# if: ${{ startsWith(matrix.os, 'macos') }}
# uses: devbotsxyz/xcode-staple@v1
# with:
# product-path: "installers/dist/SasView5.dmg"

- name: Declare env variables on push only
if: ${{ env.RELEASE == 'true' && matrix.installer && github.event_name == 'push' }}
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Declare env variables on pull_request only
if: ${{ env.RELEASE == 'true' && matrix.installer && github.event_name == 'pull_request' }}
shell: bash
run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV

- name: Upload installer to GitHub releases
if: ${{ env.RELEASE == 'true' && matrix.installer }}
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "installers/dist/SasView5.dmg, installers/Output/setupSasView.exe"
name: ${{ env.BRANCH_NAME }}
tag: ${{ env.BRANCH_NAME }}


test-installer:
needs: [ build-matrix ]

strategy:
matrix:
os: [ windows-latest, ubuntu-20.04 ]
python-version: [ 3.8 ]
python-version: [ 3.11 ]
fail-fast: false

name: Test installer
Expand Down Expand Up @@ -415,7 +379,7 @@ jobs:
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
# $INSTALL_PATH is already the base directory
tar xf "$DL_PATH/sasview5.tar.gz"
tar xf "$DL_PATH/sasview6.tar.gz"
- name: Check installation files
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# List of python versions to use for release builds
python_release_list = [
'3.8',
'3.11',
]

# List of python versions to use for tests
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Nightly Build

on:
push:
branches:
- main

jobs:

#Reuse ci.yml workflow on main branch and upload artifacts to release page
reuse_main_ci:
uses: ./.github/workflows/ci.yml
secrets: inherit

upload_nighly_builds:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest]
python-version: [ 3.11 ]
needs: reuse_main_ci

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Retrieve saved artifacts
uses: actions/download-artifact@v3
with:
path: installers/dist

- name: Display structure of downloaded files
run: ls -R
working-directory: installers/dist

- name: Rename remaining artifacts artifacts
run: |
mv installers/dist/SasView-Installer-windows-*/setupSasView.exe installers/dist/setupSasView-nightly-Win64.exe
mv installers/dist/SasView-Installer-macos-*/SasView6.dmg installers/dist/SasView-nightly-MacOSX.dmg
mv installers/dist/SasView-Installer-ubuntu-*/sasview6.tar.gz installers/dist/SasView-nightly-Linux.tar.gz
- name: Notarize Release Build (OSX)
uses: lando/notarize-action@v2
with:
product-path: "installers/dist/SasView-nightly-MacOSX.dmg"
primary-bundle-id: "org.sasview.SasView6"
appstore-connect-username: ${{ secrets.NOTARIZATION_USERNAME }}
appstore-connect-password: ${{ secrets.NOTARIZATION_PASSWORD }}
appstore-connect-team-id: W2AG9MPZ43
verbose: True

- name: Staple Release Build (OSX)
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: "installers/dist/SasView-nightly-MacOSX.dmg"

- name: Upload Nightly Build Installer to GitHub releases
uses: ncipollo/release-action@v1
with:
draft: false
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "installers/dist/setupSasView-nightly-Win64.exe, installers/dist/SasView-nightly-MacOSX.dmg, installers/dist/SasView-nightly-Linux.tar.gz"
body: "Nightly build of main SasView branch"
name: "nightly-build"
tag: "nightly-build"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ default_categories.json
**/UI/*.py
!**/UI/__init__.py
config.json
**/db.sqlite3

# doc build
/docs/sphinx-docs/build
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2022, SasView Developers
Copyright (c) 2009-2023, SasView Developers


All rights reserved.
Expand Down
13 changes: 8 additions & 5 deletions build_tools/code_sign_osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@
import subprocess
import itertools

so_list = glob.glob("SasView5.app/Contents/MacOS/**/*.so", recursive=True)
dylib_list = glob.glob("SasView5.app/Contents/MacOS/**/*.dylib", recursive=True)
so_list = glob.glob("SasView*.app/Contents/MacOS/**/*.so", recursive=True)
dylib_list = glob.glob("SasView*.app/Contents/MacOS/**/*.dylib", recursive=True)
dylib_list_resources = glob.glob(
"SasView5.app/Contents/Resources/.dylibs/*.dylib", recursive=True
"SasView*.app/Contents/Resources/.dylibs/*.dylib", recursive=True
)
zmq_dylib_list_resources = glob.glob(
"SasView*.app/Contents/Resources/zmq/.dylibs/*.dylib", recursive=True
)

sign_command = ['codesign', '--timestamp', '--options=runtime', '--verify', '--verbose=4', '--force',
'--sign', 'Developer ID Application: European Spallation Source Eric (W2AG9MPZ43)']


#TODO: Check if it is necesarry to do it per file (one long list maybe enough)
for sfile in itertools.chain(so_list, dylib_list, dylib_list_resources):
for sfile in itertools.chain(so_list, dylib_list, dylib_list_resources,
zmq_dylib_list_resources):
sign_command.append(sfile)
subprocess.check_call(sign_command)
sign_command.pop()

11 changes: 6 additions & 5 deletions build_tools/release_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#Should import release notes from git repo, for now will need to cut and paste
sasview_data = {
'metadata': {
'title': 'SasView version 5.0.5',
'description': '5.0.5 release',
'related_identifiers': [{'identifier': 'https://github.com/SasView/sasview/releases/tag/v5.0.5',
'title': 'SasView version 5.0.6',
'description': '5.0.6 release',
'related_identifiers': [{'identifier': 'https://github.com/SasView/sasview/releases/tag/v5.0.6',
'relation': 'isAlternateIdentifier', 'scheme': 'url'}],
'contributors': [
{'name': 'Anuchitanukul, Atijit', 'affiliation': 'STFC - Rutherford Appleton Laboratory', 'type':'Researcher'},
Expand Down Expand Up @@ -49,6 +49,7 @@
{'name': 'Alina, Gervaise','affiliation': 'University of Tennessee Knoxville'},
{'name': 'Attala, Ziggy', 'affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Bakker, Jurrian','affiliation': 'Technical Unviersity Delft'},
{'name': 'Beaucage, Peter','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-2147-0728'},
{'name': 'Bouwman, Wim','affiliation': 'Technical Univeristy Deflt' },
{'name': 'Bourne, Robert', 'affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Butler, Paul','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-5978-4714'},
Expand All @@ -63,7 +64,7 @@
{'name': 'Jackson, Andrew','affiliation': 'European Spallation Source ERIC', 'orcid': '0000-0002-6296-0336'},
{'name': 'King, Stephen','affiliation': 'STFC - Rutherford Appleton Laboratory', 'orcid': '0000-0003-3386-9151'},
{'name': 'Kienzle, Paul','affiliation': 'National Institute of Standards and Technology'},
{'name': 'Krzywon, Jeff','affiliation': 'National Institute of Standards and Technology'},
{'name': 'Krzywon, Jeff','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-2380-4090'},
{'name': 'Maranville, Brian', 'affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-6105-8789'},
{'name': 'Martinez, Nicolas','affiliation': 'Institut Laue-Langevin'},
{'name': 'Murphy, Ryan', 'affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-4080-7525'},
Expand All @@ -76,7 +77,7 @@
{'name': 'Snow, Tim','affiliation': 'Diamond Light Source','orcid': '0000-0001-7146-6885'},
{'name': 'Washington, Adam','affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Wilkins, Lucas','affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Wolf, Caitlyn','affiliation': 'National Institute of Standards and Technology'}
{'name': 'Wolf, Caitlyn','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-2956-7049'}
],
'grants': [{'id': '10.13039/501100000780::654000'}],
'license': 'BSD-3-Clause',
Expand Down
Loading

0 comments on commit 36d0918

Please sign in to comment.