Skip to content
name: Python Tests and Scans
on:
push:
paths:
- requirements.txt
- src/*
- test/*
- .github/workflows/python-test-scan.yml
pull_request:
paths:
- requirements.txt
- src/*
- test/*
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.8'
- name: Install Dependencies and Tools
run: |
pip install -r requirements.txt --upgrade
- run: pytest --cov=src
- name: save-json-report
if: ${{ github.event_name != 'pull_request' }}
uses: EndBug/add-and-commit@v9
with:
add: "code-coverage.json"
pull: "--rebase=true --autostash"
- name: save-reports
uses: actions/upload-artifact@v3
with:
name: Coverage Report
path: reports/coverage
isort:
name: Import Checks with ISort
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- 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 test --check --diff
black:
name: Code Format with Black
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Dependencies and Tools
run: |
pip install -r requirements.txt --upgrade
pip install black --upgrade
- run: black --check src --diff
- run: black --check test --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.8'
- name: Install Dependencies and Tools
run: |
pip install -r requirements.txt --upgrade
- run: mypy src
ruff:
name: Linter Checks with Ruff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
src: src