Add explanatory docstrings #278
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: p4pillon | |
| on: | |
| push: | |
| branches-ignore: | |
| - "documentation" | |
| tags: | |
| - '**' | |
| pull_request: | |
| branches-ignore: | |
| - "documentation" | |
| tags: | |
| - '**' | |
| workflow_dispatch: | |
| # Allow manual triggering of workflow | |
| jobs: | |
| lint: | |
| name: Use Ruff to perform linting, formatting, and other code quality tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - run: pip install .[test] | |
| - run: | | |
| ruff check --no-fix | |
| ruff format --diff | |
| test: | |
| name: Run tests on multiple Python versions | |
| needs: | |
| - lint | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] #, mac-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install .[test] | |
| PIP_PATH=$(which pip) | |
| - name: Run tests | |
| run: | | |
| PYTHON_PATH=$(which python) | |
| $PYTHON_PATH -m coverage run --source=. -m pytest tests/ | |
| - name: Gather coverage statistics | |
| if: ${{ always() }} | |
| run: | | |
| coverage report -m | |
| coverage xml | |
| - name: Upload pytest test results | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-results-${{ matrix.os }}-${{ matrix.python-version }} | |
| path: coverage.xml | |
| # Use always() to always run this step to publish test results when there are test failures | |
| build: | |
| name: Build distribution 📦 | |
| needs: | |
| - test | |
| #if: github.ref == 'refs/heads/main' # Only build dist on main | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed to fetch the tags | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install build tools | |
| run: >- | |
| pip install .[dist] | |
| - name: Build a binary wheel and a source tarball | |
| run: python -m build | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| publish-to-pypi: | |
| name: >- | |
| Publish Python 🐍 distribution 📦 to PyPI | |
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/p4pillon | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish distribution 📦 to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| publish-to-testpypi: | |
| name: Publish Python 🐍 distribution 📦 to TestPyPI | |
| if: startsWith(github.ref, 'refs/tags/test') # only publish to PyPI on tag pushes prefixed test | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/p4pillon | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish distribution 📦 to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ |