Skip to content

Add name to checkout step #2223

Add name to checkout step

Add name to checkout step #2223

Workflow file for this run

name: Tests

Check failure on line 1 in .github/workflows/tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/tests.yml

Invalid workflow file

(Line: 13, Col: 1): Unexpected value 'x-common-steps'
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '41 16 * * *' # Every day at 16:41 UTC (to avoid high load at exact hour values).
env:
UV_NO_SYNC: 1
PYTHON_VERSION: 3.14
x-common-steps:
- &checkout
name: Checkout repository
uses: actions/checkout@v4
- &setup-uv
name: Set up uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- &upload-codecov
name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
jobs:
tests-full-install:
name: Run tests with full install
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Ensure matrix jobs keep running even if one fails
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-latest, macOS-latest, windows-latest]
env:
PYTHON_VERSION: ${{ matrix.python-version }} # Override the PYTHON_VERSION of the global env
steps:
- *checkout
- *setup-uv
- name: Install default (with full options) and test dependencies
run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test
- name: Run unit and doc tests with coverage report
run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml
- *upload-codecov
tests-default-install:
name: Run (most) tests with default install
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-uv
- name: Install default (without any option) and test dependencies
run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e . --group test
- name: Run unit and doc tests with coverage report
run: |
uv run pytest -W error tests/unit tests/doc \
--ignore tests/unit/aggregation/test_cagrad.py \
--ignore tests/unit/aggregation/test_nash_mtl.py \
--ignore tests/doc/test_aggregation.py \
--cov=src --cov-report=xml
- *upload-codecov
tests-float64:
name: Run tests on float64 dtype
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-uv
- name: Install default (with full options) and test dependencies
run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test
- name: Run unit and doc tests with coverage report
run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml
env:
PYTEST_TORCH_DTYPE: float64
- *upload-codecov
build-doc:
name: Build doc
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-uv
- name: Install dependencies (default with full options & doc)
run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group doc
- name: Build Documentation
working-directory: docs
run: uv run make dirhtml
mypy:
name: Run mypy
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-uv
- name: Install dependencies (default with full options & check)
run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group check
- name: Run mypy
run: uv run mypy src/torchjd