docs: pull request template (#58) #17
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| id-token: write # Required for OIDC | |
| jobs: | |
| # Run tests before attempting release | |
| test: | |
| name: Pre-release Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v2 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Run linting | |
| run: | | |
| uv run ruff check src/ tests/ | |
| uv run ruff format --check src/ tests/ | |
| - name: Run tests | |
| run: | | |
| uv run pytest tests/ | |
| # TODO: Uncomment when coverage is needed | |
| # - name: Run tests with coverage | |
| # run: | | |
| # uv run pytest tests/ \ | |
| # --cov=src/tetra_rp \ | |
| # --cov-report=term-missing \ | |
| # --cov-fail-under=90 \ | |
| # -v | |
| release-please: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [test] # Only run if tests pass | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| config-file: .release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Build and publish to PyPI when a release is created | |
| publish: | |
| name: Build and Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [test, release-please] | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/tetra-rp | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v2 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| # TODO: Uncomment when coverage is needed | |
| # - name: Run final test suite before publishing | |
| # run: | | |
| # uv run pytest tests/ \ | |
| # --cov=src/tetra_rp \ | |
| # --cov-fail-under=90 \ | |
| # -v | |
| - name: Run final test suite before publishing | |
| run: | | |
| uv run pytest tests/ | |
| - name: Build package | |
| run: uv build | |
| - name: Verify package | |
| run: uv run twine check dist/* | |
| - name: Publish to PyPI | |
| run: uv publish --trusted-publishing automatic | |
| - name: Upload build artifacts to release | |
| if: success() | |
| run: | | |
| gh release upload ${{ needs.release-please.outputs.tag_name }} dist/* --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |