test coverage improvements #25
Workflow file for this run
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
# .github/workflows/test.yml | |
name: Tests | |
on: | |
push: | |
branches: [ main, develop ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- '.github/workflows/test.yml' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- '.github/workflows/test.yml' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.11', '3.12'] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[dev]" # Installs caption-flow with dev dependencies | |
- name: Run tests | |
run: | | |
pytest tests/ -v --cov=caption_flow --cov-report=xml --cov-report=term | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == '3.12' # Only upload once | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: false | |
verbose: true | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Cache pip packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip-lint- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruff black mypy | |
- name: Run linters | |
run: | | |
ruff check src tests || true | |
black --check src tests || true | |
mypy src --ignore-missing-imports || true # Non-blocking type checks |