|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + test: |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + python-version: ['3.13'] |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + persist-credentials: false |
| 27 | + - name: Set up Python |
| 28 | + uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: ${{ matrix.python-version }} |
| 31 | + cache: pip |
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + pip install --upgrade pip |
| 35 | + pip install . --group dev |
| 36 | + - name: Run tests |
| 37 | + run: pytest -v |
| 38 | + - name: Build wheel and sdist |
| 39 | + run: | |
| 40 | + pip install build |
| 41 | + python -m build |
| 42 | + - name: Upload build artifacts |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: dist-artifacts |
| 46 | + path: dist/ |
| 47 | + |
| 48 | + release: |
| 49 | + name: Release |
| 50 | + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') |
| 51 | + needs: [test] |
| 52 | + runs-on: ubuntu-24.04 |
| 53 | + environment: |
| 54 | + name: pypi |
| 55 | + url: https://pypi.org/p/vtk-xref |
| 56 | + permissions: |
| 57 | + id-token: write # this permission is mandatory for trusted publishing |
| 58 | + contents: write # required to create a release |
| 59 | + steps: |
| 60 | + - uses: actions/download-artifact@v4 |
| 61 | + - name: Flatten directory structure |
| 62 | + run: | |
| 63 | + mkdir -p dist/ |
| 64 | + find . -name '*.whl' -exec mv {} dist/ \; |
| 65 | + find . -name '*.tar.gz' -exec mv {} dist/ \; |
| 66 | + - name: Publish package distributions to PyPI |
| 67 | + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc |
| 68 | + - name: Create GitHub Release |
| 69 | + uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 |
| 70 | + with: |
| 71 | + generate_release_notes: true |
| 72 | + files: | |
| 73 | + ./**/*.whl |
0 commit comments