Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: CI
2
3 on:
4 push:
5 branches: [ master ]
6 pull_request:
7 branches: [ master ]
8
9 jobs:
10 lint:
11 runs-on: ubuntu-latest
12 strategy:
13 matrix:
14 include:
15 - check: lint
16 - check: mypy
17 steps:
18 - uses: actions/checkout@v4
19 - uses: astral-sh/setup-uv@v5
20 with:
21 python-version: "3.12"
22 - run: uv sync
23 - name: Run lint
24 if: matrix.check == 'lint'
25 run: uv run --with ruff ruff check caio tests
26 - name: Run mypy
27 if: matrix.check == 'mypy'
28 run: uv run --with mypy mypy --allow-untyped-calls --allow-untyped-defs --allow-untyped-decorators caio
29
30 tests:
31 needs: lint
32 runs-on: ${{ matrix.os }}
33 strategy:
34 fail-fast: false
35 matrix:
36 include:
37 - python: "3.10"
38 os: ubuntu-latest
39 - python: "3.11"
40 os: ubuntu-latest
41 - python: "3.12"
42 os: ubuntu-latest
43 - python: "3.13"
44 os: ubuntu-latest
45 - python: "3.14"
46 os: ubuntu-latest
47 # Fresh build under a free-threaded interpreter. None of the C
48 # extensions declare Py_mod_gil yet, so importing one re-enables
49 # the GIL by default - PYTHON_GIL=0 below keeps it off anyway so
50 # the suite actually exercises real no-GIL concurrency (their
51 # thread-safety is what tests/test_free_threading.py checks).
52 - python: "3.13t"
53 os: ubuntu-latest
54 free_threaded: true
55 - python: "3.14t"
56 os: ubuntu-latest
57 free_threaded: true
58 - python: "3.10"
59 os: windows-latest
60 - python: "3.11"
61 os: windows-latest
62 - python: "3.13"
63 os: windows-latest
64 - python: "3.14"
65 os: windows-latest
66 - python: "3.10"
67 os: macos-latest
68 - python: "3.11"
69 os: macos-latest
70 - python: "3.12"
71 os: macos-latest
72 - python: "3.13"
73 os: macos-latest
74 - python: "3.14"
75 os: macos-latest
76 steps:
77 - uses: actions/checkout@v4
78 - uses: astral-sh/setup-uv@v5
79 with:
80 python-version: "${{ matrix.python }}"
81 - run: uv sync --extra develop
82 - name: Run tests
83 run: uv run pytest --cov=caio --cov-report=term-missing -sv tests
84 env:
85 FORCE_COLOR: 1
86 COVERALLS_PARALLEL: 'true'
87 COVERALLS_SERVICE_NAME: github
88 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89 PYTHON_GIL: ${{ matrix.free_threaded && '0' || '' }}
90 - name: Report coverage
91 run: uv run coveralls
92 continue-on-error: true
93 env:
94 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95
96 # Builds normally under a regular interpreter, then runs the suite through
97 # a free-threaded one of the same X.Y against that same install. The
98 # compiled extensions' SOABI won't match the free-threaded interpreter, so
99 # they simply fail to import (same ImportError path as any unsupported
100 # platform) - only python_aio ends up available, and unlike the `tests`
101 # matrix's own free-threaded entries above, nothing gets the chance to
102 # re-enable the GIL first.
103 free-threaded-python-only:
104 needs: lint
105 runs-on: ubuntu-latest
106 strategy:
107 fail-fast: false
108 matrix:
109 python: ["3.13", "3.14"]
110 steps:
111 - uses: actions/checkout@v4
112 - uses: astral-sh/setup-uv@v5
113 with:
114 python-version: "${{ matrix.python }}"
115 - run: uv sync --extra develop
116 - run: uv python install "${{ matrix.python }}t"
117 - name: Run tests under the free-threaded interpreter against this install
118 run: |
119 FREE_THREADED_PYTHON="$(uv python find "${{ matrix.python }}t")"
120 PYTHONPATH="$(pwd)/.venv/lib/python${{ matrix.python }}/site-packages" "$FREE_THREADED_PYTHON" -m pytest -sv tests
121 env:
122 FORCE_COLOR: 1
123
124 finish:
125 needs:
126 - tests
127 runs-on: ubuntu-latest
128 steps:
129 - name: Coveralls Finished
130 uses: coverallsapp/github-action@v2
131 with:
132 github-token: ${{ secrets.github_token }}
133 parallel-finished: true