Bump version to 3.2.0 #66
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| # ------------------------------------------------------------------------- | |
| # Job 1: Lint + format check | |
| # ------------------------------------------------------------------------- | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync --group dev --locked | |
| - name: Run ruff check | |
| run: uv run ruff check . | |
| - name: Run ruff format check | |
| run: uv run ruff format --check . | |
| # ------------------------------------------------------------------------- | |
| # Job 2: Type checking | |
| # ------------------------------------------------------------------------- | |
| typecheck: | |
| name: Typecheck (mypy) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync --group dev --locked | |
| - name: Run mypy | |
| run: uv run mypy cca_zoo | |
| # ------------------------------------------------------------------------- | |
| # Job 3: Tests (fast, no slow markers) | |
| # ------------------------------------------------------------------------- | |
| test: | |
| name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest, macos-latest] | |
| 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 uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync --group dev --locked --python ${{ matrix.python-version }} | |
| - name: Run fast tests | |
| run: uv run pytest -m "not slow" --cov=cca_zoo --cov-report=xml | |
| # Only the modules importable without optional heavy deps (torch, | |
| # xgboost, numpyro/jax) — same rationale as the "not slow" filter | |
| # above. Runs once since doctest results don't vary by interpreter. | |
| - name: Run doctests | |
| if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' | |
| run: | | |
| uv run pytest --doctest-modules --no-cov \ | |
| cca_zoo/linear cca_zoo/nonparametric cca_zoo/datasets cca_zoo/model_selection | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' | |
| with: | |
| files: coverage.xml | |
| fail_ci_if_error: false | |
| # ------------------------------------------------------------------------- | |
| # Job 4: Slow tests (deep / probabilistic / tree — optional heavy deps) | |
| # ------------------------------------------------------------------------- | |
| test-slow: | |
| name: Test slow (deep, probabilistic, tree) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync --group dev --extra deep --extra probabilistic --extra tree --locked | |
| - name: Run slow tests | |
| run: uv run pytest -m slow --cov=cca_zoo --cov-report=xml | |
| - name: Run doctests | |
| run: | | |
| uv run pytest --doctest-modules --no-cov \ | |
| cca_zoo/deep cca_zoo/probabilistic cca_zoo/tree | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.xml | |
| fail_ci_if_error: false | |
| # ------------------------------------------------------------------------- | |
| # Job 5: Build documentation | |
| # ------------------------------------------------------------------------- | |
| docs: | |
| name: Build docs (MkDocs) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync --extra docs --locked | |
| - name: Build docs | |
| run: uv run mkdocs build --strict | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site | |
| # ------------------------------------------------------------------------- | |
| # Publish job (triggered by version tags) | |
| # ------------------------------------------------------------------------- | |
| publish: | |
| name: Publish to PyPI | |
| needs: [lint, typecheck, test] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| id-token: write # OIDC Trusted Publishing — no API secrets needed | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Build | |
| run: | | |
| uv pip install --system hatchling | |
| python -m hatchling build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |