Skip to content

🔧 Display Percentage fixes #135

🔧 Display Percentage fixes

🔧 Display Percentage fixes #135

name: Python Tests and Scans
on:
push:
paths:
- .github/workflows/python-test-scan.yml
- requirements.txt
- src/**
- tests/**
pull_request:
branches-ignore:
- docs
workflow_dispatch:
jobs:
pytest-cov:
name: Unit Test with Pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
- run: pytest --cov=src --cov-report=json:code-coverage.json
- name: artifact-html-report
uses: actions/upload-artifact@v3
with:
name: Coverage Report HTML
path: cov-html
- name: artifact-json-report
uses: actions/upload-artifact@v3
with:
name: Coverage Report JSON
path: code-coverage.json
isort:
name: Import Checks with ISort
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install isort --upgrade
- run: python3 -m isort src --check --diff
- run: python3 -m isort tests --check --diff
if: ${{ always() }}
black:
name: Code Format with Black
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install black --upgrade
- run: black --check src --diff
- run: black --check tests --diff
if: ${{ always() }}
ruff-fmt:
name: Code Format with Ruff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Ruff format
uses: chartboost/ruff-action@v1
with:
src: src tests
args: format --diff
mypy:
name: Type Checks with Mypy
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install mypy --upgrade
- run: mypy src tests --python-version 3.9
if: ${{ always() }}
- run: mypy src tests --python-version 3.10
if: ${{ always() }}
- run: mypy src tests --python-version 3.11
if: ${{ always() }}
- run: mypy src tests --python-version 3.12
if: ${{ always() }}
ruff:
name: Linter Checks with Ruff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Ruff src
uses: chartboost/ruff-action@v1
with:
src: src
args: check --show-source
- name: Ruff src diff
uses: chartboost/ruff-action@v1
if: ${{ always() }}
with:
src: src
args: check --diff
- name: Ruff tests
uses: chartboost/ruff-action@v1
if: ${{ always() }}
with:
src: tests
args: check --show-source
- name: Ruff tests diff
uses: chartboost/ruff-action@v1
if: ${{ always() }}
with:
src: tests
args: check --diff