chore: add code quality check tools as dev dependencies #25
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: Poetry Build | |
on: | |
push: | |
paths: | |
- "execenv/**" | |
- "tests/**" | |
- ".github/workflows/build.yml" | |
pull_request: | |
paths: | |
- "execenv/**" | |
- "tests/**" | |
- ".github/workflows/build.yml" | |
workflow_dispatch: | |
jobs: | |
common-checks: | |
name: Platform-independent common checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for typos | |
uses: crate-ci/typos@master | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Set up Python | |
id: python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
cache: poetry | |
- name: Set Poetry environment | |
run: poetry env use '${{ steps.python.outputs.python-path }}' | |
- name: Install dependencies | |
run: poetry install | |
- name: Lint code and check code formatting using ruff | |
run: | | |
poetry run ruff check --output-format=github . | |
poetry run ruff format --check . | |
- name: Type-check code using mypy | |
run: poetry run mypy --check-untyped-defs . | |
- name: Check import order using isort | |
run: poetry run isort -c --profile black . | |
build: | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
needs: common-checks | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Set up Python | |
id: python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: poetry | |
- name: Set Poetry environment | |
run: poetry env use '${{ steps.python.outputs.python-path }}' | |
- name: Install dependencies | |
run: poetry install | |
- name: Run tests | |
run: poetry run pytest -vvv --cov=execenv --cov-report=xml:coverage.xml | |
- name: Upload results to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: execenv | |
verbose: true | |
files: ./coverage.xml | |
env_vars: OS,PYTHON | |
- name: Build package | |
run: poetry build |