|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize, reopened, ready_for_review] |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + tests: |
| 18 | + if: github.event.pull_request.draft == false || github.event_name == 'push' |
| 19 | + name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + strategy: |
| 22 | + fail-fast: true |
| 23 | + matrix: |
| 24 | + os: ["ubuntu-latest", "macos-latest", "windows-latest"] |
| 25 | + # only run for MSV Python 3.10 on PRs, but all versions on pushes to main |
| 26 | + python-version: ${{ github.event_name == 'push' && fromJSON('["3.10", "3.11", "3.12"]') || fromJSON('["3.10"]') }} |
| 27 | + env: |
| 28 | + TURN_OFF_MPS_IF_RUNNING_CI: 1 |
| 29 | + MPLBACKEND: Agg |
| 30 | + steps: |
| 31 | + - name: Checkout code |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Set up Python ${{ matrix.python-version }} |
| 35 | + uses: actions/setup-python@v5 |
| 36 | + with: |
| 37 | + python-version: ${{ matrix.python-version }} |
| 38 | + |
| 39 | + - name: Install uv |
| 40 | + uses: astral-sh/setup-uv@v7 |
| 41 | + with: |
| 42 | + python-version: ${{ matrix.python-version }} |
| 43 | + enable-cache: true |
| 44 | + cache-suffix: ${{ runner.os }}-${{ matrix.python-version }} |
| 45 | + activate-environment: true |
| 46 | + |
| 47 | + - name: Install dependencies |
| 48 | + run: | |
| 49 | + uv sync --extra dev |
| 50 | +
|
| 51 | + - name: Test with pytest |
| 52 | + run: | |
| 53 | + # stop pytest after 3 failures to save CI time |
| 54 | + uv run pytest --maxfail=3 --cov-report=xml --cov-report=html |
0 commit comments