| name: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Unit Tests — Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "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: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ matrix.python-version }} | |
| - name: Install core dependencies (CPU-only torch) | |
| run: | | |
| pip install --upgrade pip | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install numpy | |
| pip install -e ".[dev]" | |
| - name: Lint with ruff | |
| run: ruff check ugtc/ tests/ | |
| - name: Type check with mypy | |
| run: mypy ugtc/ --ignore-missing-imports | |
| - name: Run tests | |
| run: pytest tests/ -v --tb=short --cov=ugtc --cov-report=term-missing | |
| - name: Upload coverage | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: false | |
| lint: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install lint tools | |
| run: pip install ruff black isort | |
| - name: Check formatting (black) | |
| run: black --check ugtc/ tests/ examples/ | |
| - name: Check imports (isort) | |
| run: isort --check ugtc/ tests/ examples/ | |
| - name: Lint (ruff) | |
| run: ruff check ugtc/ tests/ examples/ | |