BaseFormmatter, TerseFormatter, and ExtendedFormatter #54
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: Run Tests | |
env: | |
PIP_CACHE_DIR: .pip | |
PYTHONPATH: src | |
on: | |
push: | |
paths: | |
- ".github/workflows/py-tests.yml" | |
- ".requirements/*.txt" | |
- "examples/**" | |
- "src/**" | |
- "tests/**" | |
- "setup.cfg" | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
release: | |
types: ["published"] | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
# Run on all supported versions | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Set Up Python {{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Cache dependencies | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ./.pip | |
key: ${{ runner.os }}-tests-{{ matrix.python-version }}-${{ hashFiles('./.requirements/lint.txt') }}-${{ hashFiles('./.requirements/test.txt') }} | |
- name: Upgrade Pip | |
run: python -m pip install --upgrade pip | |
- name: Upgrade Build | |
run: pip install --upgrade build | |
- name: Install Dependencies | |
run: pip install -IU -r ./.requirements/lint.txt -r ./.requirements/test.txt -r ./.requirements/extras.txt | |
- name: Check Formatting | |
run: black --check examples/ src/ tests/ | |
- name: Check Ruff | |
run: ruff -q examples/ src/ tests/ | |
- name: Check Mypy | |
run: mypy --strict --no-warn-unused-ignores src/ | |
- name: Run Tests | |
run: coverage run -m pytest -v | |
- name: Coverage Report | |
run: coverage report | |
publish: | |
runs-on: ubuntu-20.04 | |
needs: test | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Set Up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Upgrade Pip | |
run: python -m pip install --upgrade pip | |
- name: Upgrade Build | |
run: pip install --upgrade build | |
- name: Build Package | |
run: python -m build --sdist --wheel | |
# - name: Publish distribution 📦 to Test PyPI | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |