[Feature] Improve GitHub Issue Template Guidelines Placement #39
Workflow file for this run
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: Test and Publish | |
on: | |
push: | |
branches: [ main ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
code-quality: | |
name: Code Quality | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install quality tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[dev] | |
- name: Check formatting with Black | |
run: black --check src/pkynetics tests --exclude "_version.py" | |
- name: Check imports with isort | |
run: isort --check-only src/pkynetics tests | |
- name: Run type checker | |
run: mypy | |
test: | |
name: Tests - Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
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: | | |
python -m pip install --upgrade pip | |
pip install hatch | |
pip install .[dev] | |
pip install pytest-cov | |
- name: Run tests with coverage | |
run: | | |
python -m pytest tests/ --cov=pkynetics --cov-report=xml --junitxml=junit.xml | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
files: coverage.xml | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
publish: | |
name: Publish to PyPI | |
needs: [ test, code-quality ] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pkynetics | |
permissions: | |
id-token: write | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install hatch | |
pip install .[dev] | |
- name: Build package | |
run: hatch build | |
- name: Test package | |
run: pytest tests/ | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |