Propagate exceptions correctly from setSLMImage() #118
Workflow file for this run
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 and publish | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
jobs: | |
upload: | |
name: Upload to PyPI | |
if: github.repository == 'micro-manager/pymmcore' | |
runs-on: ubuntu-latest | |
needs: [sdist, wheels-manylinux, wheels-winmac] | |
steps: | |
- name: Download wheels and sdist | |
uses: actions/download-artifact@v3 | |
- name: Collect wheels and sdist | |
run: | | |
mkdir dist | |
mv pymmcore-sdist/* dist/ | |
mv pymmcore-wheels-manylinux/* dist/ | |
mv pymmcore-wheels-win-mac/* dist/ | |
ls dist | |
- name: Upload release to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
sdist: | |
name: sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout submodules | |
run: | | |
git submodule sync --recursive | |
git submodule update --init --force --recursive --depth=1 | |
- name: Install tools and dependencies | |
run: | | |
sudo apt-get install -y python3-dev python3-pip python3-venv | |
python3 -m venv venv | |
source venv/bin/activate | |
pip install --upgrade pip build | |
- name: Create source distribution | |
run: | | |
source venv/bin/activate | |
python -m build --sdist --outdir dist/ . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pymmcore-sdist | |
path: dist | |
wheels-manylinux: | |
strategy: | |
fail-fast: true | |
matrix: | |
manylinux-version: ['2014'] | |
arch: [i686, x86_64] | |
include: | |
- arch: i686 | |
numpy-versions: cp38-cp38 1.17.3 cp39-cp39 1.19.3 | |
- arch: x86_64 | |
numpy-versions: cp38-cp38 1.17.3 cp39-cp39 1.19.3 cp310-cp310 1.21.3 cp311-cp311 1.23.2 | |
name: manylinux${{ matrix.manylinux-version }}_${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
env: | |
AUDITWHEEL_PLAT: manylinux${{ matrix.manylinux-version }}_${{ matrix.arch }} | |
DOCKER_IMAGE: quay.io/pypa/manylinux${{ matrix.manylinux-version }}_${{ matrix.arch }} | |
NUMPY_VERSIONS: ${{ matrix.numpy-versions }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout submodules | |
run: | | |
git submodule sync --recursive | |
git submodule update --init --force --recursive --depth=1 | |
- name: Pull image | |
run: | | |
docker pull $DOCKER_IMAGE | |
- name: Build | |
run: | | |
docker run -e NUMPY_VERSIONS -e AUDITWHEEL_PLAT -v $(pwd):/io $DOCKER_IMAGE /io/manylinux/build.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pymmcore-wheels-manylinux | |
path: wheelhouse | |
wheels-winmac: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [Windows, macOS] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
python-arch: [x64, x86] | |
macos-deployment-target: ['10.9'] | |
msvc-version: ['14.1'] # VS2017 | |
include: | |
- os: Windows | |
runner: windows-latest | |
- os: macOS | |
runner: macOS-latest | |
- python-version: '3.8' | |
mac-python-version: 3.8.10 | |
mac-python-installer-macos-version: macosx10.9 | |
numpy-version: 1.17.3 | |
- python-version: '3.9' | |
mac-python-version: 3.9.7 | |
mac-python-installer-macos-version: macosx10.9 | |
numpy-version: 1.19.3 | |
- python-version: '3.10' | |
mac-python-version: 3.10.0 | |
mac-python-installer-macos-version: macos11 | |
numpy-version: 1.21.3 | |
- python-version: '3.11' | |
mac-python-version: 3.11.0 | |
mac-python-installer-macos-version: macos11 | |
numpy-version: 1.23.2 | |
- python-arch: x64 | |
msvc-arch: amd64 | |
- python-arch: x86 | |
msvc-arch: x86 | |
exclude: | |
- os: macOS | |
python-arch: x86 | |
- os: Windows # NumPy has 64-bit only for Windows wheels >= cp310 | |
python-version: '3.10' | |
python-arch: x86 | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} ${{ matrix.python-arch }} | |
runs-on: ${{ matrix.runner }} | |
env: | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-deployment-target }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout submodules | |
run: | | |
git submodule sync --recursive | |
git submodule update --init --force --recursive --depth=1 | |
- name: Find Visual Studio (Windows) | |
if: matrix.os == 'Windows' | |
shell: pwsh | |
run: | | |
$VsDir = (& "${Env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere" -latest -property installationPath) | |
echo "VCVARSALL_DIR=$VsDir/VC/Auxiliary/Build" >>$Env:GITHUB_ENV | |
- name: Install Python (generic) | |
uses: actions/setup-python@v4 | |
if: matrix.os != 'macOS' | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.python-arch }} | |
- name: Install Python (macOS) | |
if: matrix.os == 'macOS' | |
run: | | |
curl -L -o python.pkg https://www.python.org/ftp/python/${{ matrix.mac-python-version }}/python-${{ matrix.mac-python-version }}-${{ matrix.mac-python-installer-macos-version }}.pkg | |
sudo installer -pkg python.pkg -target / | |
/Library/Frameworks/Python.framework/Versions/${{ matrix.python-version }}/bin/python3 -m venv venv | |
- name: Install tools (Windows) | |
if: matrix.os == 'Windows' | |
run: | | |
choco install -y swig | |
- name: Install tools (macOS) | |
if: matrix.os == 'macOS' | |
run: | | |
brew install swig | |
- name: Install dependencies (Windows) | |
if: matrix.os == 'Windows' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools wheel | |
python -m pip install numpy==${{ matrix.numpy-version }} | |
- name: Install dependencies (Unix) | |
if: matrix.os != 'Windows' | |
run: | | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools wheel | |
python -m pip install numpy==${{ matrix.numpy-version }} | |
- name: Package and extract sources (Windows) | |
if: matrix.os == 'Windows' | |
run: | | |
python setup.py sdist --format=zip | |
mkdir tmp | |
Expand-Archive -Path dist/pymmcore-*.zip -DestinationPath tmp | |
mv tmp/pymmcore-* tmp/pymmcore | |
- name: Package and extract sources (Unix) | |
if: matrix.os == 'macOS' | |
run: | | |
source venv/bin/activate | |
python setup.py sdist | |
mkdir tmp | |
tar xvzf dist/pymmcore-*.tar.gz -C tmp | |
mv tmp/pymmcore-* tmp/pymmcore | |
- name: Build wheel (Windows) | |
if: matrix.os == 'Windows' | |
shell: cmd | |
env: | |
MSSdk: 1 | |
DISTUTILS_USE_SDK: 1 | |
PY_VCRUNTIME_REDIST: 1 | |
run: | | |
pushd "%VCVARSALL_DIR%" | |
call vcvarsall.bat ${{ matrix.msvc-arch }} -vcvars_ver=${{ matrix.msvc-version }} | |
popd | |
cd tmp\pymmcore | |
python setup.py build_ext | |
python setup.py build | |
python setup.py bdist_wheel | |
- name: Build wheel (macOS) | |
if: matrix.os == 'macOS' | |
env: | |
CC: clang | |
CXX: clang++ | |
CFLAGS: -fvisibility=hidden -Wno-unused-variable | |
run: | | |
source venv/bin/activate | |
cd tmp/pymmcore | |
python setup.py build_ext -j2 | |
python setup.py build | |
python setup.py bdist_wheel | |
- name: Log undefined symbols (macOS) | |
if: matrix.os == 'macOS' | |
run: | | |
cd tmp/pymmcore | |
PYMOD=$(echo build/lib.*/pymmcore/_pymmcore_swig.*.so) | |
echo "$PYMOD:" | |
echo 'Weak symbols:' | |
nm -mu $PYMOD |c++filt |grep ' weak ' # This is never empty | |
echo '-- end of weak symbols --' | |
echo 'Undefined symbols not containing Py:' | |
nm -mu $PYMOD |c++filt |grep 'dynamically looked up' |grep -v _Py && exit 1 | |
echo '-- end of non-Py dynamically looked up symbols --' | |
- name: Smoke test (Windows) | |
if: matrix.os == 'Windows' | |
run: | | |
cd .. # Avoid picking up pymmcore.py from cwd | |
python -m pip install (Get-Item pymmcore/tmp/pymmcore/dist/pymmcore-*.whl).FullName | |
python pymmcore/smoketest/smoke.py | |
- name: Smoke test (Unix) | |
if: matrix.os != 'Windows' | |
run: | | |
source venv/bin/activate | |
cd .. # Avoid picking up pymmcore.py from cwd | |
python -m pip install pymmcore/tmp/pymmcore/dist/pymmcore-*.whl | |
python pymmcore/smoketest/smoke.py | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pymmcore-wheels-win-mac | |
path: tmp/pymmcore/dist |