Cicd combined #64
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
| # SPDX-License-Identifier: Apache-2.0 | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| pre-commit: | |
| name: Pre-commit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| # Run the exact same hooks as the local pre-commit stage (ruff, toml/yaml | |
| # validity, link/import validation, SPDX headers, whitespace/EOF, uv-lock, | |
| # nbstripout, ...) so CI and pre-commit can never drift. `uv` must be on | |
| # PATH for the uv-lock hook. | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Cache pre-commit hook environments | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Run pre-commit hooks | |
| run: uvx pre-commit run --all-files --show-diff-on-failure --color=always | |
| test-cpu: | |
| name: CPU Tests (Python ${{ matrix.python-version }}) | |
| needs: pre-commit | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync --frozen --group dev --extra hf --extra compose | |
| - name: Run CPU tests | |
| run: | | |
| # CI runs only tests/unit/ — the fast, self-contained CPU set. | |
| # The marker filter still applies: tests that download/compose real | |
| # models (requires_model), need CUDA (gpu), hit the network / take | |
| # long (slow), or are the expensive code-theory suite (deep) are | |
| # excluded. | |
| # tests/composer/ and tests/hf/ are NOT run here: even filtered they | |
| # are heavy enough to exhaust the GitHub Actions CPU-minutes quota and | |
| # get killed mid-run. All of that coverage runs on the GPU cluster. | |
| uv run pytest tests/unit/ \ | |
| -m "not requires_model and not gpu and not slow and not deep" \ | |
| -v -s --tb=short -x \ | |
| --cov=granite_switch --cov-report=xml | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.xml | |
| fail_ci_if_error: false |