Merge pull request #23 from spdlearn/cache-CI #59
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: tests | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| - "main" | |
| pull_request: | |
| branches: | |
| - '*' | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| exclude: | |
| # Exclude some combinations to reduce CI time | |
| - os: macos-latest | |
| python-version: "3.12" | |
| - os: windows-latest | |
| python-version: "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: Set up uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Create/Restore Data Caches mne and Nilearn | |
| id: cache-data | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/mne_data | |
| ~/nilearn_data | |
| key: ${{ runner.os }}-${{ matrix.python-version }}-data-v1 | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.python-version }}-data | |
| - name: Install dependencies | |
| run: uv pip install --system -e .[tests,brain] | |
| - name: Run tests with coverage | |
| run: pytest tests/ -v --cov=spd_learn --cov-report=xml --cov-report=term-missing | |
| - name: Test documentation code blocks | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
| run: | | |
| uv pip install --system scipy # Required for some doc examples | |
| pytest docs/ -v | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| verbose: true | |
| # Separate job for integration tests (optional, can be slow) | |
| integration: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Create/Restore Data Caches | |
| id: cache-data | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/mne_data | |
| ~/nilearn_data | |
| key: ${{ runner.os }}-integration-data-v1 | |
| restore-keys: | | |
| ${{ runner.os }}-integration-data | |
| - name: Install all dependencies | |
| run: uv pip install --system -e .[all] | |
| - name: Run integration tests | |
| run: pytest tests/ -v -m integration --run-slow |