Repository navigation
pytest #122
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: pytest | |
| on: | |
| push: | |
| branches: | |
| - main # Your branch name | |
| paths: | |
| - '**/*.py' # Trigger for changes in Python files | |
| pull_request: | |
| branches: | |
| - main # Your branch name | |
| paths: | |
| - '**/*.py' # Trigger for changes in Python files | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt # Install dependencies | |
| - name: Run tests on Linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| echo "Running tests on Linux with Python ${{ matrix.python-version }}" | |
| export PYTHONPATH="${{ github.workspace }}" | |
| pytest -rA -Wignore::DeprecationWarning --cov=pySWATPlus --cov-report=xml | |
| shell: bash | |
| - name: Run tests on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| Write-Host "Running tests on Windows with Python ${{ matrix.python-version }}" | |
| $env:PYTHONPATH = "${{ github.workspace }}" | |
| pytest -rA -Wignore::DeprecationWarning --cov=pySWATPlus --cov-report=xml | |
| - name: Upload coverage to Codecov # Upload coverage report to Codecov | |
| uses: codecov/codecov-action@v4.2.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} # This secret token should be added in your repository settings | |