Skip to content

ci: add ruff, isort and mypy for code quality check #24

ci: add ruff, isort and mypy for code quality check

ci: add ruff, isort and mypy for code quality check #24

Workflow file for this run

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: Install code quality tools
run: pipx install ruff isort mypy
- name: Check for typos
uses: crate-ci/typos@master
- name: Lint code and check code formatting using ruff
run: |
ruff check --output-format=github .
ruff format --check .
- name: Type-check code using mypy
run: mypy --check-untyped-defs .
- name: Check import order using isort
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