Update and run all pre commit hooks #754
This file contains hidden or 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 and deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: ${{ matrix.platform }} py${{ matrix.python-version }} | |
| runs-on: ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install Qt libraries on Linux | |
| if: runner.os == 'Linux' | |
| uses: tlambert03/setup-qt-libs@v1 | |
| - name: Install Windows OpenGL | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git | |
| ./gl-ci-helpers/appveyor/install_opengl.ps1 | |
| if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) { | |
| exit 0 | |
| } else { | |
| exit 1 | |
| } | |
| - name: Install tox | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install tox tox-gh-actions | |
| - name: Test with tox on Linux | |
| if: runner.os == 'Linux' | |
| uses: GabrielBB/xvfb-action@v1 | |
| with: | |
| run: python -m tox | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| QT_API: pyqt6 | |
| PYTEST_QT_API: pyqt6 | |
| VISPY_USE_APP: pyqt6 | |
| QT_OPENGL: software | |
| PYVISTA_OFF_SCREEN: true | |
| - name: Test with tox on Windows/macOS | |
| if: runner.os != 'Linux' | |
| run: python -m tox | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| QT_API: pyqt6 | |
| PYTEST_QT_API: pyqt6 | |
| VISPY_USE_APP: pyqt6 | |
| QT_OPENGL: software | |
| PYVISTA_OFF_SCREEN: true | |
| - name: Upload coverage | |
| if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| deploy: | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build twine | |
| - name: Build package | |
| run: | | |
| python -m build | |
| - name: Check package | |
| run: | | |
| python -m twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} | |
| run: | | |
| twine upload dist/* |