Skip to content

More updates

More updates #30

Workflow file for this run

name: CI Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/test_requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
# Install the package in development mode
pip install -e .
- name: Install RustyMS (optional dependency)
run: |
pip install rustyms || echo "RustyMS installation failed, tests will skip RustyMS-dependent functionality"
- name: Lint with flake8
run: |
pip install flake8
# 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. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Type check with mypy
run: |
pip install mypy
mypy . --ignore-missing-imports || echo "MyPy check completed with warnings"
- name: Run fast tests
run: |
python -m pytest tests/ -v -m "fast" --tb=short || echo "Fast tests completed"
- name: Run unit tests
run: |
python -m pytest tests/ -v -m "unit" --tb=short --maxfail=10
- name: Run integration tests
run: |
python -m pytest tests/ -v -m "integration" --tb=short --maxfail=5
- name: Run all tests with coverage
run: |
pip install coverage pytest-cov
python -m pytest tests/ --cov=. --cov-report=xml --cov-report=html --tb=short --maxfail=20
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
performance-tests:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
pip install -e .
pip install rustyms || echo "RustyMS optional"
- name: Run performance tests
run: |
python -m pytest tests/ -v -m "performance" --tb=short || echo "Performance tests completed"
- name: Run memory tests
run: |
python -m pytest tests/ -v -m "memory" --tb=short || echo "Memory tests completed"
docs-and-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort
- name: Check code formatting with Black
run: |
black --check --diff .
- name: Check import sorting with isort
run: |
isort --check-only --diff .
- name: Validate test framework
run: |
python -m pip install -r test_requirements.txt
python tests/validate_testing_framework.py || echo "Test framework validation completed"