Merge pull request #31 from thewtex/ci-actions-bump #25
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-test-publish" | |
on: [push, pull_request] | |
jobs: | |
build_wheel: | |
name: Build Python wheels | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: "Build pure Python wheels" | |
run: | | |
python -m pip wheel -w dist -e src/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheel | |
path: ./dist/itk_dreg-*.whl | |
pytest: | |
name: "Test with PyTest" | |
runs-on: ubuntu-latest | |
needs: | |
- build_wheel | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: "Install Dependencies" | |
shell: bash | |
run: | | |
python -m pip install flit | |
cd src | |
flit install --deps develop | |
- name: Download Python Wheel Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheel | |
- name: "Install itk_dreg from Wheel Artifact" | |
run: | | |
wheel_name_full=`(find . -name "itk_dreg-*.whl")` | |
python -m pip uninstall -y itk_dreg | |
python -m pip install ${wheel_name_full} | |
- name: "Run Tests" | |
shell: bash | |
run: | | |
pytest ./test -vvv -s -k "not localcluster and not serialize_pairwise_result" | |
publish: | |
needs: | |
- build_wheel | |
- pytest | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
environment: | |
name: pypi | |
url: https://pypi.org/p/itk-dreg | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Download Python Wheel Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheel | |
path: dist | |
- name: "Publish Python wheel to the Python Package Index" | |
uses: pypa/gh-action-pypi-publish@v1.8.10 | |
with: | |
skip_existing: true |