Skip to content

Implement Comprehensive Testing Suite for Kevin's Adventure Game #2

Implement Comprehensive Testing Suite for Kevin's Adventure Game

Implement Comprehensive Testing Suite for Kevin's Adventure Game #2

Workflow file for this run

name: Test Suite
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- 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 -r requirements-test.txt
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Format check with black
run: |
black --check --diff .
- name: Import sort check with isort
run: |
isort --check-only --diff .
- name: Type check with mypy
run: |
mypy game/ locations/ utils/ main.py --ignore-missing-imports
- name: Run unit tests
run: |
pytest tests/unit/ -v --cov=game --cov=locations --cov=utils --cov=main
- name: Run integration tests
run: |
pytest tests/integration/ -v
- name: Run scenario tests
run: |
pytest tests/scenarios/ -v
- name: Run performance tests
run: |
pytest tests/performance/ -v --benchmark-only
- name: Generate coverage report
run: |
pytest --cov=game --cov=locations --cov=utils --cov=main --cov-report=xml --cov-report=html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
- name: Archive coverage reports
uses: actions/upload-artifact@v3
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bandit safety
- name: Run security checks with bandit
run: |
bandit -r game/ locations/ utils/ main.py
- name: Check dependencies for security vulnerabilities
run: |
safety check