Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
uschmidt83 committed Apr 25, 2024
1 parent 59e7973 commit e0233e1
Showing 1 changed file with 92 additions and 108 deletions.
200 changes: 92 additions & 108 deletions .github/workflows/cibuildwheel.yml
Expand Up @@ -14,6 +14,53 @@ on:
- published

jobs:

build_wheels_linux_windows:
name: Build ${{ matrix.py }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
py: [cp36, cp37, cp38, cp39, cp310, cp311, cp312]
include:
- cibw_test_requires: 'pytest tensorflow'
- os: ubuntu-latest
py: cp37
cibw_test_requires: 'pytest tensorflow urllib3<2' # ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels for CPython (Linux and Windows)
run: python -m cibuildwheel --output-dir dist
env:
# only build for platforms where tensorflow is available
CIBW_BUILD: "${{ matrix.py }}-*{x86_64,win_amd64}"
CIBW_SKIP: "*musllinux*"
# numba is a requirement and only has wheels for manylinux2014
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: "${{ matrix.cibw_test_requires }}"
CIBW_TEST_COMMAND: pytest -v -m "not gpu" {project}
# CIBW_TEST_SKIP: "*musllinux*"

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist/*.whl


build_wheels_mac:
# build wheels for macOS, using an x86_64-based runner to build both x86_64 and arm64 wheels
# (better would be to build arm64 wheels on an arm64-based runner, but c++ compilation throws errors and haven't debugged why)
Expand Down Expand Up @@ -96,7 +143,6 @@ jobs:
path: ./dist/*.whl



test_wheels_mac_arm64:
# test arm64 wheels for macOS using an arm64-based runner
name: Test py${{ matrix.python-version }}-${{ matrix.arch }} wheels on ${{ matrix.os }}
Expand Down Expand Up @@ -133,112 +179,50 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Disable PytestReturnNotNoneWarning (Python 3.7+)
if: matrix.python-version != 3.6
run: echo "PYTEST_ADDOPTS='-W ignore::pytest.PytestReturnNotNoneWarning'" >> $GITHUB_ENV
- name: Run tests
run: pytest -v -m "not gpu"


build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz


upload_pypi:
name: Upload to PyPI
needs: [build_wheels_linux_windows, test_wheels_mac_arm64, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download wheels and sdist
uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Check that package version matches git tag ${{ github.ref_name }}
shell: bash
run: |
ls -l dist
test -f "dist/stardist-${{ github.ref_name }}.tar.gz"
- name: Run tests
run: pytest -m "not gpu"
env:
PYTEST_ADDOPTS: '-W ignore::pytest.PytestReturnNotNoneWarning'



# build_wheels:
# name: Build ${{ matrix.py }} wheels on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, windows-latest]
# py: [cp36, cp37, cp38, cp39, cp310, cp311, cp312]
# include:
# - cibw_test_requires: 'pytest tensorflow'
# - os: ubuntu-latest
# py: cp37
# cibw_test_requires: 'pytest tensorflow urllib3<2' # ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168

# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Install Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.x'

# - name: Install cibuildwheel
# run: python -m pip install cibuildwheel

# - name: Check if conda is installed
# shell: bash
# run: |
# command -v conda && ret=$? || ret=$?
# echo "CONDA_INSTALLED=$ret" >> $GITHUB_ENV

# - name: Build wheels for CPython (Linux and Windows)
# if: startsWith(matrix.os, 'macos') == false
# run: |
# python -m cibuildwheel --output-dir dist
# env:
# # only build for platforms where tensorflow is available
# CIBW_BUILD: "${{ matrix.py }}-*{x86_64,win_amd64}"
# CIBW_SKIP: "*musllinux*"
# # numba is a requirement and only has wheels for manylinux2014
# CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# CIBW_BUILD_VERBOSITY: 1
# CIBW_TEST_REQUIRES: "${{ matrix.cibw_test_requires }}"
# CIBW_TEST_COMMAND: pytest -v -m "not gpu" {project}
# # CIBW_TEST_SKIP: "*musllinux*"

# - name: Upload wheels
# uses: actions/upload-artifact@v3
# with:
# name: dist
# path: ./dist/*.whl


# build_sdist:
# name: Build source distribution
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Build sdist
# run: pipx run build --sdist

# - name: Upload sdist
# uses: actions/upload-artifact@v3
# with:
# name: dist
# path: dist/*.tar.gz


# upload_pypi:
# name: Upload to PyPI
# needs: [build_wheels, build_wheels_mac, build_sdist]
# runs-on: ubuntu-latest
# if: github.event_name == 'release' && github.event.action == 'published'
# steps:
# - name: Download wheels and sdist
# uses: actions/download-artifact@v3
# with:
# name: dist
# path: dist

# - name: Check that package version matches git tag ${{ github.ref_name }}
# shell: bash
# run: |
# ls -l dist
# test -f "dist/stardist-${{ github.ref_name }}.tar.gz"

# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
# verbose: true
# # password: ${{ secrets.TESTPYPI_API_TOKEN }}
# # repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
# password: ${{ secrets.TESTPYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/

0 comments on commit e0233e1

Please sign in to comment.