Skip to content

refactoring structure #23

refactoring structure

refactoring structure #23

name: Python Tests and Scans
on:
push:
paths:
- requirements.txt
- src/**
- tests/**
- .github/workflows/python-test-scan.yml
pull_request:
paths:
- requirements.txt
- src/**
- tests/**
workflow_dispatch:
concurrency: updates-project
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.11'
- name: Install Dependencies and Tools
run: |
pip install -r requirements.txt --upgrade
- run: pytest --cov=src
- name: commit-json-report
if: ${{ github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "code-coverage.json"
pull: "--rebase=true --autostash"
- name: artifact-html-report
uses: actions/upload-artifact@v3
with:
name: Coverage Report
path: cov-html
isort:
name: Import Checks with ISort
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Dependencies and Tools
run: |
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.11'
- name: Install Dependencies and Tools
run: |
pip install -r requirements.txt --upgrade
pip install black --upgrade
- run: black --check src --diff
- run: black --check tests --diff
if: ${{ always() }}
mypy:
name: Type Checks with Mypy
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Dependencies and Tools
run: |
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