Repository navigation
feat(KMR): add end-to-end integration tests for models #46
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: "Unit Tests" | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - main | |
| paths: | |
| - "**.py" | |
| - "tests/**" | |
| - "kmr/**" | |
| pull_request: | |
| branches: | |
| - dev | |
| - main | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| paths: | |
| - "**.py" | |
| - "tests/**" | |
| - "kmr/**" | |
| workflow_dispatch: | |
| inputs: | |
| PYTHON_VERSION: | |
| required: false | |
| default: 3.11 | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| 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@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction --no-root | |
| - name: Install project | |
| run: poetry install --no-interaction | |
| - name: Run linting | |
| run: | | |
| poetry run ruff check kmr/ tests/ --select F,E,W,C4 --ignore ANN,D,UP,COM,SIM,PTH,S,B,N,ARG,ISC,E402,F401 | |
| poetry run black --check kmr/ tests/ | |
| - name: Run type checking | |
| run: poetry run mypy kmr/ --ignore-missing-imports --no-strict-optional | |
| - name: Run tests | |
| run: poetry run pytest tests/ -v --cov=kmr --cov-report=xml --cov-report=html --ignore=tests/integration/ | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == 3.11 | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false |