Files
Workflow config file is invalid. Please check your config file: resolve aliases: yaml: line 3: did not find expected key

59 lines
11 KiB
YAML

name: Tests and Linting
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov flake8 bandit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests with pytest
run: pytest --cov=. --cov-report=xml --cov-report=term-missing
- name: Check coverage threshold
run: coverage report --fail-under=70
- name: Upload coverage reports
if: always()
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Bandit
run: pip install bandit
- name: Run Bandit security scan
run: |
bandit -r . -f json -o bandit-report.json
bandit -r . -f txt
- name: Upload Bandit report
if: always()
uses: actions/upload-artifact@v3
with:
name: bandit-security-report
path: bandit-report.json