Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: Continuous Integration
2
3 on:
4 workflow_call:
5 pull_request:
6 push:
7 branches:
8 - master
9
10 permissions:
11 contents: read
12
13 jobs:
14 lint:
15 name: 🎨 Linters
16 runs-on: ubuntu-latest
17 steps:
18 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19 with:
20 persist-credentials: false
21 - name: Set up Python
22 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
23 with:
24 python-version: '3'
25 - name: Install CI Requirements
26 run: |
27 python -m pip install -r ci-requirements.txt --require-hashes
28 - name: Pre-commit checks
29 run: nox -s lint
30
31 tests:
32 name: ✅ Tests
33 runs-on: ubuntu-22.04
34
35 strategy:
36 fail-fast: false
37 matrix:
38 python-version:
39 - "3.7"
40 - "3.8"
41 - "3.9"
42 - "3.10"
43 - "3.11"
44 - "3.12"
45 - "3.13"
46 - "3.14"
47
48 steps:
49 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50 with:
51 persist-credentials: false
52 - name: Set up Python ${{ matrix.python-version }}
53 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
54 with:
55 python-version: ${{ matrix.python-version }}
56 allow-prereleases: true
57 - name: Install CI Requirements
58 run: |
59 python -m pip install -r ci-requirements.txt --require-hashes
60 - name: Run tests
61 run: nox -s test-${{ matrix.python-version }}
62 - name: "Upload artifact"
63 uses: "actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f"
64 with:
65 name: coverage-data-${{ matrix.python-version }}
66 path: ".coverage.*"
67 include-hidden-files: true
68 if-no-files-found: error
69
70 detection_coverage:
71
72 needs:
73 - tests
74
75 name: 📈 Detection Coverage
76 runs-on: ubuntu-latest
77
78 steps:
79 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
80 with:
81 persist-credentials: false
82 - name: Set up Python
83 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
84 with:
85 python-version: '3'
86 - name: Install CI Requirements
87 run: |
88 python -m pip install -r ci-requirements.txt --require-hashes
89 - name: Coverage WITH preemptive
90 run: nox -s coverage -- --coverage 97 --with-preemptive
91 - name: Coverage WITHOUT preemptive
92 run: nox -s coverage -- --coverage 96
93 - name: "Upload artifact"
94 uses: "actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f"
95 with:
96 name: coverage-data-using-internal-coverage
97 path: ".coverage.*"
98 include-hidden-files: true
99 if-no-files-found: error
100
101 integration_test:
102
103 needs:
104 - tests
105
106 name: 🔗 Integration Tests
107 runs-on: ubuntu-latest
108
109 strategy:
110 fail-fast: false
111 matrix:
112 downstream_project:
113 - niquests
114 - requests
115
116 steps:
117 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
118 with:
119 persist-credentials: false
120 - name: Set up Python
121 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
122 with:
123 python-version: '3'
124 - name: Install CI Requirements
125 run: |
126 python -m pip install -r ci-requirements.txt --require-hashes
127 - name: Integration Tests with Requests
128 run: nox -s downstream_${{ matrix.downstream_project }}
129
130 chardet_bc:
131
132 name: ⏪ Chardet Backward-Compatibility Test
133 runs-on: ubuntu-latest
134
135 steps:
136 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
137 with:
138 persist-credentials: false
139 - name: Set up Python
140 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
141 with:
142 python-version: '3'
143 - name: Install CI Requirements
144 run: |
145 python -m pip install -r ci-requirements.txt --require-hashes
146 - name: BC Coverage
147 run: nox -s backward_compatibility -- --coverage 80
148
149 mypyc_test:
150
151 name: ⚡ MypyC Tests
152
153 needs:
154 - tests
155
156 runs-on: ${{ matrix.os }}
157
158 strategy:
159 fail-fast: false
160 matrix:
161 python-version:
162 - "3.8"
163 - "3.9"
164 - "3.10"
165 - "3.11"
166 - "3.12"
167 - "3.13"
168 - "3.14"
169 - "3.14t"
170 os: [ ubuntu-latest, macos-latest, windows-latest ]
171 env:
172 PYTHONIOENCODING: utf8 # only needed for Windows (console IO output encoding)
173 steps:
174 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
175 with:
176 persist-credentials: false
177 - name: Set up Python ${{ matrix.python-version }}
178 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
179 with:
180 python-version: ${{ matrix.python-version }}
181 allow-prereleases: true
182 - name: Install CI Requirements
183 run: |
184 python -m pip install -r ci-requirements.txt --require-hashes
185 - name: Run tests with mypyc enabled
186 run: nox -s test_mypyc-${{ matrix.python-version }}
187 - name: "Upload artifact"
188 uses: "actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f"
189 with:
190 name: coverage-data-mypyc-${{ matrix.os }}-${{ matrix.python-version }}
191 path: ".coverage.*"
192 include-hidden-files: true
193 if-no-files-found: error
194
195 coverage:
196 if: always()
197 runs-on: "ubuntu-latest"
198 needs:
199 - tests
200 - mypyc_test
201 - detection_coverage
202 steps:
203 - name: "Checkout repository"
204 uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
205
206 - name: "Setup Python"
207 uses: "actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405"
208 with:
209 python-version: "3.x"
210
211 - name: Install CI Requirements
212 run: |
213 python -m pip install -r ci-requirements.txt --require-hashes
214
215 - name: "Download artifact"
216 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
217 with:
218 pattern: coverage-data*
219 merge-multiple: true
220
221 - name: "Combine & check coverage"
222 run: |
223 python -m coverage combine
224 python -m coverage html --skip-covered --skip-empty
225 python -m coverage report --ignore-errors --show-missing --fail-under=92
226
227 - name: "Upload report"
228 uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
229 with:
230 name: coverage-report
231 path: htmlcov
232
233 performance:
234 name: ⚡ Performance Test
235 runs-on: ubuntu-latest
236
237 needs: coverage
238
239 steps:
240 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
241 with:
242 persist-credentials: false
243 - name: Set up Python
244 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
245 with:
246 python-version: '3'
247 - name: Install CI Requirements
248 run: |
249 python -m pip install -r ci-requirements.txt --require-hashes
250 - name: Performance Measurement
251 run: nox -s performance