Add comprehensive test suite with GitHub Actions CI/CD integration #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-tk xvfb | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov | |
| shell: bash | |
| - name: Install requirements if present | |
| run: | | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| shell: bash | |
| if: runner.os != 'Windows' | |
| - name: Install requirements if present (Windows) | |
| run: | | |
| if (Test-Path requirements.txt) { pip install -r requirements.txt } | |
| shell: pwsh | |
| if: runner.os == 'Windows' | |
| - name: Run tests (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| xvfb-run -a python -m pytest tests/ -v --cov=. --cov-report=xml --cov-report=term | |
| - name: Run tests (Windows/macOS) | |
| if: runner.os != 'Linux' | |
| run: | | |
| python -m pytest tests/ -v --cov=. --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false |