20x fast convex_hull_image for 2D #337
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: Tests | |
on: [ pull_request ] | |
env: | |
MODULE_NAME: imops | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Check the version | |
if: "! github.event.pull_request.head.repo.fork " | |
run: | | |
VERSION=$(python -c "from pathlib import Path; import runpy; folder, = {d.parent for d in Path().resolve().glob('*/__init__.py') if d.parent.is_dir() and (d.parent / '__version__.py').exists()}; print(runpy.run_path(folder / '__version__.py')['__version__'])") | |
MATCH=$(pip index versions "$MODULE_NAME" | grep "Available versions:" | grep $VERSION) || echo | |
echo $MATCH | |
if [ "$GITHUB_BASE_REF" = "master" ] && [ "$MATCH" != "" ]; then exit 1; fi | |
- name: Build the package | |
run: | | |
pip install build | |
python -m build --sdist | |
- name: Install | |
run: | | |
pip install dist/* | |
pip install -r tests/requirements.txt | |
cd tests | |
export MODULE_PARENT=$(python -c "import $MODULE_NAME, os; print(os.path.dirname($MODULE_NAME.__path__[0]))") | |
export MODULE_PARENT=${MODULE_PARENT%"/"} | |
cd .. | |
echo $MODULE_PARENT | |
echo "MODULE_PARENT=$(echo $MODULE_PARENT)" >> $GITHUB_ENV | |
- name: Check python code style | |
run: | | |
pip install -r requirements-linters.txt | |
flake8 . | |
isort --check . | |
black --check . | |
- name: Check Cython code style | |
run: | | |
pip install cython-lint | |
cython-lint imops/src | |
- name: Test with pytest | |
run: | | |
pytest tests -m "not nonumba" --junitxml=reports/junit-${{ matrix.python-version }}.xml --cov="$MODULE_PARENT/$MODULE_NAME" --cov-report=xml --cov-branch | |
pip uninstall numba -y | |
pytest tests/test_backend.py -m nonumba | |
- name: Generate coverage report | |
run: | | |
coverage xml -o reports/coverage-${{ matrix.python-version }}.xml --omit=imops/src/_numba_zoom.py | |
sed -i -e "s|$MODULE_PARENT/||g" reports/coverage-${{ matrix.python-version }}.xml | |
sed -i -e "s|$(echo $MODULE_PARENT/ | tr "/" .)||g" reports/coverage-${{ matrix.python-version }}.xml | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reports-${{ matrix.python-version }} | |
path: reports/*-${{ matrix.python-version }}.xml | |
if: ${{ always() }} | |
- name: Upload coverage results | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
files: reports/coverage-${{ matrix.python-version }}.xml | |
verbose: true |