Add workflow for publishing to pypi #12
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: Test | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install mri2mesh | |
run: | | |
python -m pip install -e ".[test]" | |
- name: Test with pytest | |
run: | | |
python -m pytest --cov=mri2mesh --cov-report html --cov-report xml --cov-report term-missing -v | |
- name: Coverage report | |
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' | |
run: | | |
python3 -m coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY | |
python3 -m coverage json | |
export TOTAL=$(python3 -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
- name: Upload HTML report. | |
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-report | |
path: htmlcov |