91 lines
2.2 KiB
YAML
91 lines
2.2 KiB
YAML
---
|
|
name: Linting
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
# XXX need to do stuff with uv
|
|
jobs:
|
|
linting:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.11"
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '${{ matrix.python-version }}'
|
|
cache: 'pip'
|
|
cache-dependency-path: 'requirements.txt'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Analyse code with Pylint
|
|
run: |
|
|
pylint $(git ls-files '*.py')
|
|
|
|
- name: Analyse code with Flake8
|
|
run: |
|
|
flake8 $(git ls-files '*.py')
|
|
|
|
- name: Analyse code with Mypy
|
|
run: |
|
|
mypy --install-types --non-interactive $(git ls-files '*.py')
|
|
|
|
- name: Analyse code with Bandit
|
|
run: |
|
|
bandit -x '**/test_*.py,./.venv/**' -r .
|
|
|
|
test-and-coverage:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.11"
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '${{ matrix.python-version }}'
|
|
cache: 'pip'
|
|
cache-dependency-path: 'requirements.txt'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Run tests with coverage
|
|
run: |
|
|
pytest --cov=./ --cov-report=term --cov-report=xml --cov-report=html --junitxml=report.xml tests
|
|
|
|
- name: Upload coverage artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage-reports
|
|
path: |
|
|
coverage.xml
|
|
htmlcov/
|
|
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-results
|
|
path: report.xml
|