|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop, staging ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + python-version: ["3.14", "3.12", "3.13", "3.9", "3.10", "3.11" ] |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v5 |
| 19 | + |
| 20 | + - name: Set up Python ${{ matrix.python-version }} |
| 21 | + uses: actions/setup-python@v6 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + cache: 'pip' |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install -e ".[dev]" |
| 30 | +
|
| 31 | + - name: Lint with flake8 |
| 32 | + run: | |
| 33 | + # Stop the build if there are Python syntax errors or undefined names |
| 34 | + flake8 src/tmo_api --count --select=E9,F63,F7,F82 --show-source --statistics |
| 35 | + # Exit-zero treats all errors as warnings |
| 36 | + flake8 src/tmo_api --count --exit-zero --max-line-length=88 --extend-ignore=E203,W503 --statistics |
| 37 | +
|
| 38 | + - name: Check formatting with black |
| 39 | + run: | |
| 40 | + black --check src/tmo_api tests/ |
| 41 | +
|
| 42 | + - name: Check import sorting with isort |
| 43 | + run: | |
| 44 | + isort --check-only src/tmo_api tests/ |
| 45 | +
|
| 46 | + - name: Type check with mypy |
| 47 | + run: | |
| 48 | + mypy src/tmo_api --ignore-missing-imports |
| 49 | + continue-on-error: true |
| 50 | + |
| 51 | + - name: Run tests with pytest |
| 52 | + run: | |
| 53 | + pytest tests/ -v --cov=tmo_api --cov-report=xml --cov-report=term |
| 54 | +
|
| 55 | + - name: Upload coverage to Codecov |
| 56 | + if: matrix.python-version == '3.11' |
| 57 | + uses: codecov/codecov-action@v5 |
| 58 | + env: |
| 59 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 60 | + with: |
| 61 | + file: ./coverage.xml |
| 62 | + fail_ci_if_error: false |
0 commit comments