Skip to content

Merge branch 'master' of https://github.com/nion-software/nionui-tool #94

Merge branch 'master' of https://github.com/nion-software/nionui-tool

Merge branch 'master' of https://github.com/nion-software/nionui-tool #94

Workflow file for this run

name: Build
on:
push:
branches: [ master ]
tags: '*'
pull_request:
branches: [ master ]
env:
tool-id: nionswift-tool
tool-package: nionswift
tool-exe: nionswift --app
jobs:
build_linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: ["3.11", "3.12", "3.13"]
qt-version: ["6.8.1"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
- name: Build
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install setuptools --upgrade
python -m pip install packaging build cibuildwheel
pushd launcher
PYTHON=`python -c "import sys; print(sys.executable, end='')"`
cmake CMakeLists.txt -DGIT_REPO=${{ github.repository }} -DGIT_REF=${{ github.ref }} -DGIT_SHA=${{ github.sha }}
cmake --build . --config Release
mkdir -p linux
mv build linux/x64
popd
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6Core.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6DBus.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6Gui.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6OpenGL.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6Widgets.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6XcbQpa.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libicui18n.so.73 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libicudata.so.73 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libicuuc.so.73 launcher/linux/x64
mkdir -p launcher/linux/x64/plugins/platforms
mkdir -p launcher/linux/x64/plugins/imageformats
cp ../Qt/${{ matrix.qt-version }}/gcc_64/plugins/platforms/libqxcb.so launcher/linux/x64/plugins/platforms
cp ../Qt/${{ matrix.qt-version }}/gcc_64/plugins/imageformats/libq* launcher/linux/x64/plugins/imageformats
rm launcher/linux/x64/plugins/imageformats/libqsvg.so
chrpath -r "\$ORIGIN" launcher/linux/x64/libicu*.so.73
chrpath -r "\$ORIGIN/../.." launcher/linux/x64/plugins/platforms/libqxcb.so
chrpath -r "\$ORIGIN/../.." launcher/linux/x64/plugins/imageformats/*.so
printf "[Paths]\nPrefix=.\nPlugins=plugins\n" > launcher/linux/x64/qt.conf
python -m build .
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
miniconda-version: "latest"
- name: Build Conda Package
shell: bash -l {0}
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
conda update --all -q -y
conda install -q conda-build -y
conda build -q --python ${{ matrix.python-version }} ./.github/workflows/recipe
OUT_FILE=$(conda build --python ${{ matrix.python-version }} --output ./.github/workflows/recipe)
mv $OUT_FILE dist
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-linux-whl-${{ matrix.python-version }}
path: dist/*.whl
- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-linux-conda-${{ matrix.python-version }}
path: dist/*.tar.bz2
build_macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
python-version: ["3.11", "3.12", "3.13"]
architecture: [x86_64]
qt-version: ["6.8.1"]
include:
- os: macos-14
python-version: "3.12"
architecture: arm64
qt-version: "6.8.1"
- os: macos-14
python-version: "3.13"
architecture: arm64
qt-version: "6.8.1"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'mac'
target: 'desktop'
- name: Build
shell: bash
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
MACOS_DEVELOPER_TEAM_ID: ${{ secrets.MACOS_DEVELOPER_TEAM_ID }}
run: |
APPNAME="Nion Swift"
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install packaging build cibuildwheel
pushd launcher
PYTHON=`python -c "import sys; print(sys.executable, end='')"`
cmake CMakeLists.txt -DGIT_REPO=${{ github.repository }} -DGIT_REF=${{ github.ref }} -DGIT_SHA=${{ github.sha }}
cmake --build . --config Release
pushd build
echo -n "$MACOS_CERTIFICATE" | base64 -d > certificate.p12
echo "Create keychain"
security create-keychain -p "$MACOS_KEYCHAIN_PASSWORD" build.keychain
echo "Set default keychain"
security default-keychain -s build.keychain
echo "Unlock keychain"
security unlock-keychain -p "$MACOS_KEYCHAIN_PASSWORD" build.keychain
echo "Import certificate (disabled)"
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
echo "Find identity"
security find-identity -v
echo "Set key partition list (avoids dialog)"
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_KEYCHAIN_PASSWORD" build.keychain
echo "Code sign"
# remove files that will not be signed and have can be regenerated
find "$APPNAME.app" -name "__pycache__" -exec rm -rf {} \; -prune
find "$APPNAME.app" -name "*.pyc" -exec rm -rf {} \; -prune
# sign files from the inside out. first ensure that dylibs are executable. then find all executable files
# and sign them. then sign apps within frameworks. then sign frameworks. then sign the app itself.
codesign --remove-signature --deep --force "$APPNAME.app/Contents/MacOS/$APPNAME"
find "$APPNAME.app" -name "*.dylib" -exec chmod +x {} \;
find "$APPNAME.app" -type f -perm +111 -and -not -name "*.py" -exec /usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" {} --options runtime --timestamp --deep --force --verbose \;
find "$APPNAME.app/Contents/Frameworks" -name "*.app" -exec /usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" {} --options runtime --timestamp --deep --force --verbose \;
find "$APPNAME.app" -name "*.framework" -exec /usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" {} --options runtime --timestamp --deep --force --verbose \;
/usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" "$APPNAME.app" --entitlements ../entitlements.xml --options runtime --timestamp --deep --force --verbose
rm certificate.p12
popd
mkdir -p build/Release
mv build/*.app build/Release
tar -czf "build/Release/$APPNAME.app.tar.gz" "build/Release/$APPNAME.app"
popd
PYTHON_VERSION_COMPRESSED=$(echo "${{ matrix.python-version }}" | sed 's/\.//g')
export CIBW_ARCHS_MACOS="${{ matrix.architecture }}"
export CIBW_BUILD=cp$PYTHON_VERSION_COMPRESSED-macosx_${{ matrix.architecture }}
export CIBW_REPAIR_WHEEL_COMMAND=""
python -m cibuildwheel --output-dir dist
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-macos-whl-${{ matrix.architecture }}-${{ matrix.python-version }}
path: dist/*.whl
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
miniconda-version: "latest"
architecture: ${{ matrix.architecture }}
- name: Build Conda Package
shell: bash -l {0}
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
conda update --all -q -y
conda install -q conda-build -y
conda build -q --python ${{ matrix.python-version }} ./.github/workflows/recipe
OUT_FILE=$(conda build --python ${{ matrix.python-version }} --output ./.github/workflows/recipe)
mv $OUT_FILE dist
- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-macos-conda-${{ matrix.architecture }}-${{ matrix.python-version }}
path: dist/*.tar.bz2
build_win:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
python-version: ["3.11", "3.12", "3.13"]
qt-version: ["6.8.1"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
shell: pwsh
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2022_64'
- name: Build
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install packaging build cibuildwheel
pushd launcher
$PYTHON_EXEC = python -c "import sys; print(sys.executable, end='')"
cmake CMakeLists.txt -DGIT_REPO=${{ github.repository }} -DGIT_REF=${{ github.ref }} -DGIT_SHA=${{ github.sha }}
cmake --build . --config Release
Get-ChildItem -Include *.pdb -Recurse | foreach { $_.Delete() }
Get-ChildItem build\Release\imageformats -Include *d.dll -Recurse | foreach { $_.Delete() }
Rename-Item -Path build\Release\NionSwiftLauncher.exe -NewName NionSwift.exe
Remove-Item -Recurse -Force x64\*
Move-Item -Path build\Release -Destination x64
popd
python -m build .
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
miniconda-version: "latest"
- name: Build Conda Package
shell: bash -l {0}
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
conda update --all -q -y
conda install -q conda-build -y
conda build -q --python ${{ matrix.python-version }} ./.github/workflows/recipe
OUT_FILE=$(conda build --python ${{ matrix.python-version }} --output ./.github/workflows/recipe)
mv $OUT_FILE dist
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-win-whl-${{ matrix.python-version }}
path: dist/*.whl
- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-win-conda-${{ matrix.python-version }}
path: dist/*.tar.bz2
test_linux:
needs: build_linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Download Wheel
uses: actions/download-artifact@v4
id: download_wheel
with:
name: ${{ env.tool-id }}-linux-whl-${{ matrix.python-version }}
path: downloads
- name: Download Conda
uses: actions/download-artifact@v4
id: download_conda
with:
name: ${{ env.tool-id }}-linux-conda-${{ matrix.python-version }}
path: conda_downloads
- name: Set up Python ${{ matrix.python-version }} with official build
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Virtual screen
shell: bash
run: |
# update package list. see https://github.com/actions/runner-images/issues/10785#issuecomment-2420741561
sudo apt-get update
sudo apt-get install xvfb -y
# libopengl0: see https://bugreports.qt.io/browse/QTBUG-89754
sudo apt-get install libopengl0 -y
# see https://doc.qt.io/qt-6/linux-requirements.html
sudo apt-get install libegl1 libfontconfig1 libfreetype6 libxcb1 libxcb-glx0 libxcb-keysyms1 libxcb-image0 libxcb-shm0 libxcb-icccm4 libxcb-xfixes0 libxcb-shape0 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 libxcb-sync1 libxcb-cursor0 -y
# sudo apt-get install libx11 libx11-xcb libxext libxfixes libxi libxrender libxcb-sync libxcb-util libxkbcommon
- name: Test system Python installed with official build with virtual environment
shell: bash
run: |
sudo apt update
python -m pip install --upgrade pip
SYSTEM_PYTHON_EXE=python
$SYSTEM_PYTHON_EXE -m venv test_venv
source test_venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
python -m pip install ${{steps.download_wheel.outputs.download-path}}/*.whl
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test... ${{ env.tool-exe }}"
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack
sleep 5
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack | grep ACK
sleep 5
deactivate
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test-environment
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Test Conda
# this test is disabled on ubuntu until default channel supports numpy 2
if: False
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
conda create -q -n test-env-conda -c conda-forge python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools pip -y
conda activate test-env-conda
# this does not work on ubuntu with Qt 6.8.
# until numpy 2 is available, use pip
# pip install numpy scipy h5py imageio setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion ${{ env.tool-package }}
conda install -q -y ${{steps.download_conda.outputs.download-path}}/*.tar.bz2
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack
sleep 5
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack | grep ACK
sleep 5
conda deactivate
- name: Test Conda Forge
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
conda create -q -n test-env -c conda-forge python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools -y
conda activate test-env
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion -c conda-forge ${{ env.tool-package }}
conda install -q -y -c conda-forge ${{steps.download_conda.outputs.download-path}}/*.tar.bz2
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack
sleep 5
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack | grep ACK
sleep 5
conda deactivate
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-20.04'
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
echo "conda create anaconda-client env"
conda create -n upload-env -q conda-build anaconda-client -y
echo "activate"
conda activate upload-env
echo "conda info"
conda info
echo "conda list"
conda list
echo "directory list"
ls -Rl ${{steps.download_conda.outputs.download-path}}
echo "anaconda upload"
anaconda --token ${{ secrets.anaconda_token }} upload --user nion --skip-existing ${{steps.download_conda.outputs.download-path}}/*.tar.bz2
echo "deactivate"
conda deactivate
echo "popd"
popd
test_macos:
needs: build_macos
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
python-version: ["3.11", "3.12", "3.13"]
architecture: [x86_64]
qt-version: ["6.8.1"]
include:
- os: macos-14
python-version: "3.12"
architecture: arm64
qt-version: "6.8.1"
- os: macos-14
python-version: "3.13"
architecture: arm64
qt-version: "6.8.1"
steps:
- uses: actions/checkout@v4
- name: Download Wheel
uses: actions/download-artifact@v4
id: download_wheel
with:
name: ${{ env.tool-id }}-macos-whl-${{ matrix.architecture }}-${{ matrix.python-version }}
path: downloads
- name: Download Conda
uses: actions/download-artifact@v4
id: download_conda
with:
name: ${{ env.tool-id }}-macos-conda-${{ matrix.architecture }}-${{ matrix.python-version }}
path: conda_downloads
- name: Set up Python ${{ matrix.python-version }} with official build
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test system Python installed with brew with virtual environment
shell: bash
run: |
brew update
brew install python@${{ matrix.python-version }} || true
SYSTEM_PYTHON_EXE=/usr/local/bin/python${{ matrix.python-version }}
$SYSTEM_PYTHON_EXE -m venv test_venv
source test_venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
python -m pip install ${{steps.download_wheel.outputs.download-path}}/*.whl
python --version
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
- name: Test system Python installed with official build with virtual environment
shell: bash
run: |
SYSTEM_PYTHON_EXE=python3
$SYSTEM_PYTHON_EXE -m venv test_venv
source test_venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
python -m pip install ${{steps.download_wheel.outputs.download-path}}/*.whl
python --version
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
deactivate
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test-environment
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
auto-activate-base: false
- name: Test Conda
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
# until numpy 2 is available, use pip
pip install numpy scipy h5py imageio setuptools
## use nomkl until anaconda gets its act together
# conda install -q nomkl numpy scipy h5py imageio setuptools -y
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion ${{ env.tool-package }}
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Installing '$FILENAME'"
conda install -q -y -c conda-forge $FILENAME
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
- name: Test Conda Forge
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
# use nomkl until anaconda gets its act together
conda create -n test-env -c conda-forge -q python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools -y
conda activate test-env
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion -c conda-forge ${{ env.tool-package }}
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Installing '$FILENAME'"
conda install -q -y -c conda-forge $FILENAME
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
conda deactivate
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
conda create -n upload-env -q conda-build anaconda-client -y
conda activate upload-env
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Send to Anaconda '$FILENAME'"
anaconda --token ${{ secrets.anaconda_token }} upload --user nion --skip-existing $FILENAME
conda deactivate
popd
test_win:
needs: build_win
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Download Wheel
uses: actions/download-artifact@v4
id: download_wheel
with:
name: ${{ env.tool-id }}-win-whl-${{ matrix.python-version }}
path: downloads
- name: Download Conda
uses: actions/download-artifact@v4
id: download_conda
with:
name: ${{ env.tool-id }}-win-conda-${{ matrix.python-version }}
path: conda_downloads
- name: Set up Python ${{ matrix.python-version }} with official build
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test system Python installed with official build with virtual environment
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m venv test_venv
test_venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
$filename = Get-ChildItem -name ${{steps.download_wheel.outputs.download-path}}\*.whl
python -m pip install ${{steps.download_wheel.outputs.download-path}}\$filename
python --version
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
deactivate
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test-environment
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Test Conda
shell: pwsh
run: |
# use conda versions instead of pypi versions. install before anything else.
conda update -q --all -y
# until numpy 2 is available, use pip
pip install numpy scipy h5py imageio setuptools
# conda install -q numpy scipy h5py imageio setuptools pip -y
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion ${{ env.tool-package }}
$filename = Get-ChildItem -name ${{steps.download_conda.outputs.download-path}}\*.tar.bz2
conda install -q -y ${{steps.download_conda.outputs.download-path}}\$filename
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
- name: Test Conda Forge
shell: pwsh
run: |
# use conda versions instead of pypi versions. install before anything else.
conda create -n test-env -c conda-forge -q python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools -y
conda activate test-env
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion -c conda-forge ${{ env.tool-package }}
$filename = Get-ChildItem -name ${{steps.download_conda.outputs.download-path}}\*.tar.bz2
conda install -q -y -c conda-forge ${{steps.download_conda.outputs.download-path}}\$filename
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
conda deactivate
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'windows-2019'
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
conda create -n upload-env -q conda-build anaconda-client -y
conda activate upload-env
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Send to Anaconda '$FILENAME'"
anaconda --token ${{ secrets.anaconda_token }} upload --user nion --skip-existing $FILENAME
conda deactivate
popd
pypi-publish:
name: Upload release to PyPI
needs: [test_linux, test_macos, test_win]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
environment:
name: release
url: https://pypi.org/p/nionswift-tool
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
- name: Remove all the files except the ones to upload to PyPI.
shell: bash
run: |
mkdir dist
find . -name "*cp311*.whl" -exec cp {} dist \;
ls -Rl .
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
print-hash: true