Debian Codegraph @

.github/workflows/test.yml

raw
1 name: test suite
2
3 on:
4 push:
5 branches: [master, "4.12.x"]
6 pull_request:
7
8 jobs:
9 changed-files:
10 runs-on: ubuntu-latest
11 outputs:
12 workflow-changed: ${{ steps.changed-files.outputs.workflow_any_changed }}
13 pyproject-changed: ${{ steps.changed-files.outputs.src_any_changed }}
14 src-changed: ${{ steps.changed-files.outputs.src_any_changed }}
15 tests-changed: ${{ steps.changed-files.outputs.tests_any_changed }}
16 docs-changed: ${{ steps.changed-files.outputs.doc_any_changed }}
17 steps:
18 - uses: actions/checkout@v6
19 - name: Get changed files by category
20 id: changed-files
21 uses: tj-actions/changed-files@v47
22 with:
23 files_yaml: |
24 workflow:
25 - .github/workflows/test.yml
26 pyproject:
27 - pyproject.toml
28 src:
29 - src/**
30 tests:
31 - tests/**
32 doc:
33 - README.rst
34 - docs/**
35
36 pyright:
37 runs-on: ubuntu-latest
38 needs: changed-files
39 if: |
40 ${{
41 (needs.changed-files.outputs.workflow-changed == 'true')
42 || (needs.changed-files.outputs.src-changed == 'true')
43 }}
44 steps:
45 - uses: actions/checkout@v6
46 - name: Set up Python
47 uses: actions/setup-python@v6
48 with:
49 python-version: 3.x
50 - uses: actions/cache@v5
51 with:
52 path: ~/.cache/pip
53 key: pip-pyright
54 - name: Install dependencies
55 run: pip install -e . pyright
56 - name: Run pyright
57 run: pyright --ignoreexternal --verifytypes anyio
58
59 test:
60 strategy:
61 fail-fast: false
62 matrix:
63 os: [ubuntu-latest]
64 python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", pypy-3.11]
65 extras: ["[trio]"]
66 lowest-bound: [false]
67 include:
68 - os: macos-latest
69 python-version: "3.9"
70 extras: "[trio]"
71 - os: macos-latest
72 python-version: "3.14"
73 extras: "[trio]"
74 - os: windows-latest
75 python-version: "3.9"
76 extras: "[trio]"
77 - os: windows-latest
78 python-version: "3.14"
79 extras: "[trio]"
80 - name: only asyncio
81 os: ubuntu-latest
82 python-version: "3.14"
83 extras: ""
84 - name: oldest dependencies
85 os: ubuntu-latest
86 python-version: "3.9"
87 extras: "[trio]"
88 lowest-bound: true
89 runs-on: ${{ matrix.os }}
90 needs: changed-files
91 if: |
92 ${{
93 (needs.changed-files.outputs.workflow-changed == 'true')
94 || (needs.changed-files.outputs.pyproject-changed == 'true')
95 || (needs.changed-files.outputs.src-changed == 'true')
96 || (needs.changed-files.outputs.tests-changed == 'true')
97 }}
98 steps:
99 - uses: actions/checkout@v6
100 - name: Set up Python ${{ matrix.python-version }}
101 uses: actions/setup-python@v6
102 with:
103 python-version: ${{ matrix.python-version }}
104 allow-prereleases: true
105 cache: pip
106 cache-dependency-path: pyproject.toml
107 - name: Install the project and its dependencies
108 if: matrix.lowest-bound == false
109 run: pip install --group test -e .${{ matrix.extras }}
110 - name: Install the project and its dependencies (lowest bound)
111 if: matrix.lowest-bound == true
112 run: |
113 pip install uv
114 uv pip install --system --resolution lowest-direct --group test -e .${{ matrix.extras }}
115 - name: Patch /etc/hosts
116 if: runner.os != 'Windows'
117 run: |
118 echo "1.2.3.4 xn--fa-hia.de" | sudo tee -a /etc/hosts
119 echo "5.6.7.8 fass.de" | sudo tee -a /etc/hosts
120 - name: Patch C:\Windows\System32\drivers\etc\hosts
121 if: runner.os == 'Windows'
122 run: |
123 Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "1.2.3.4 xn--fa-hia.de"
124 Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "5.6.7.8 fass.de"
125 - name: Test with pytest
126 run: coverage run -m pytest -v
127 timeout-minutes: 5
128 env:
129 PYTEST_DISABLE_PLUGIN_AUTOLOAD: 1
130 - name: Generate coverage report
131 run: coverage xml
132 - name: Upload Coverage
133 uses: coverallsapp/github-action@v2
134 with:
135 parallel: true
136 file: coverage.xml
137
138 docs:
139 runs-on: ubuntu-latest
140 needs: changed-files
141 if: |
142 ${{
143 (needs.changed-files.outputs.workflow-changed == 'true')
144 || (needs.changed-files.outputs.pyproject-changed == 'true')
145 || (needs.changed-files.outputs.src-changed == 'true')
146 || (needs.changed-files.outputs.docs-changed == 'true')
147 }}
148 steps:
149 - uses: actions/checkout@v6
150 - name: Set up Python ${{ matrix.python-version }}
151 uses: actions/setup-python@v6
152 with:
153 python-version: "3.11"
154 cache: pip
155 cache-dependency-path: pyproject.toml
156 - name: Install the project and its dependencies
157 run: pip install --group doc -e .
158 - name: Build documentation
159 run: sphinx-build -W docs build/sphinx
160
161 coveralls:
162 name: Finish Coveralls
163 needs: test
164 runs-on: ubuntu-latest
165 steps:
166 - name: Finished
167 uses: coverallsapp/github-action@v2
168 with:
169 parallel-finished: true