Debian Codegraph @

.github/workflows/run-all-tests.yml

raw symbols SCIP
1 # This workflow will install Python dependencies,
2 # run tests and lint with a variety of Python versions
3 ---
4 name: Tests
5 on: [push, pull_request]
6
7 jobs:
8 cpython:
9 runs-on: ubuntu-latest
10 strategy:
11 matrix:
12 python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15-dev']
13
14 steps:
15 - uses: actions/checkout@v5
16 - name: Set up Python ${{ matrix.python-version }}
17 uses: actions/setup-python@v6
18 with:
19 python-version: ${{ matrix.python-version }}
20 - name: Install dependencies
21 run: |
22 python -m pip install --upgrade pip wheel
23 pip install -e ".[tests]"
24 - name: Test with pytest
25 run: |
26 pytest tests
27
28 cpython-lxml:
29 runs-on: ubuntu-latest
30 strategy:
31 matrix:
32 python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
33 steps:
34 - uses: actions/checkout@v5
35 - name: Set up Python ${{ matrix.python-version }}
36 uses: actions/setup-python@v6
37 with:
38 python-version: ${{ matrix.python-version }}
39 - name: Install dependencies
40 run: |
41 python -m pip install --upgrade pip wheel
42 pip install -e ".[tests, lxml]"
43 - name: Test with pytest
44 run: |
45 pytest tests --cov=fastkml --cov=tests --cov-fail-under=95 --cov-report=xml
46 - name: "Upload coverage to Codecov"
47 if: ${{ matrix.python-version==3.11 }}
48 uses: codecov/codecov-action@v5
49 with:
50 fail_ci_if_error: true
51 verbose: true
52 token: ${{ secrets.CODECOV_TOKEN }}
53
54 doctest-lxml:
55 runs-on: ubuntu-latest
56 strategy:
57 matrix:
58 python-version: ['3.12']
59
60 steps:
61 - uses: actions/checkout@v5
62 - name: Set up Python ${{ matrix.python-version }}
63 uses: actions/setup-python@v6
64 with:
65 python-version: ${{ matrix.python-version }}
66 - name: Install dependencies
67 run: |
68 python -m pip install --upgrade pip wheel
69 pip install -e ".[tests, lxml, docs]"
70 - name: test the python code in the documentation
71 run: |
72 python -m doctest docs/*.rst
73 - name: Run the python code in the examples
74 run: |
75 python examples/read_kml.py
76 python examples/shp2kml.py
77 python examples/shp2kml_timed.py
78 python examples/simple_example.py
79 python examples/transform_cascading_style.py
80
81
82 static-tests:
83 runs-on: ubuntu-latest
84 strategy:
85 matrix:
86 python-version: ['3.12']
87
88 steps:
89 - uses: actions/checkout@v5
90 - name: Set up Python ${{ matrix.python-version }}
91 uses: actions/setup-python@v6
92 with:
93 python-version: ${{ matrix.python-version }}
94 - name: Install dependencies
95 run: |
96 python -m pip install --upgrade pip wheel
97 pip install -e ".[typing, complexity, linting, tests]"
98 - name: Typecheck
99 run: |
100 mypy fastkml tests
101 - name: Linting
102 run: |
103 ruff check --no-fix fastkml tests examples docs
104 ruff format --check fastkml tests examples docs
105 yamllint .github/
106 yamllint .*.y*ml
107 - name: Check complexity
108 run: |
109 radon cc --min B fastkml
110 radon mi --min B fastkml
111 complexipy fastkml
112 lizard fastkml
113
114 pypy:
115 runs-on: ubuntu-latest
116 strategy:
117 matrix:
118 pypy-version: ['pypy-3.9', 'pypy-3.10', 'pypy-3.11']
119 steps:
120 - uses: actions/checkout@v5
121 - name: Set up Python ${{ matrix.pypy-version }}
122 uses: actions/setup-python@v6
123 with:
124 python-version: ${{ matrix.pypy-version }}
125 - name: Install dependencies
126 run: |
127 python -m pip install --upgrade pip wheel setuptools
128 python -m pip install -e ".[tests]"
129 - name: Test with pytest
130 run: |
131 pytest tests
132
133 graalpy:
134 runs-on: ubuntu-latest
135 strategy:
136 matrix:
137 graalpy-version: ['graalpy-24.1', 'graalpy-25.0']
138 steps:
139 - uses: actions/checkout@v5
140 - name: Set up Python ${{ matrix.graalpy-version }}
141 uses: actions/setup-python@v6
142 with:
143 python-version: ${{ matrix.graalpy-version }}
144 - name: Install dependencies
145 run: |
146 pip install -e ".[tests]"
147 - name: Test with pytest, excluding hypothesis tests
148 run: |
149 pytest tests -m "not hypothesis"
150
151
152 build-package:
153 name: Build & inspect our package.
154 runs-on: ubuntu-latest
155 steps:
156 - uses: actions/checkout@v5
157 - uses: hynek/build-and-inspect-python-package@v2
158 - uses: actions/setup-python@v6
159 with:
160 python-version: '3.12'
161 - name: Check with pyroma
162 run: |
163 python -m pip install pyroma
164 pyroma .
165 - name: Check tag name
166 if: >-
167 github.event_name == 'push' &&
168 startsWith(github.ref, 'refs/tags')
169 run: |
170 python -m pip install vercheck
171 vercheck $GITHUB_REF_NAME fastkml/about.py
172
173 test-publish:
174 if: >-
175 github.event_name == 'push' &&
176 github.repository == 'cleder/fastkml' &&
177 startsWith(github.ref, 'refs/tags')
178 needs: [cpython, static-tests, pypy, cpython-lxml, doctest-lxml, build-package, graalpy]
179 name: Test install on TestPyPI
180 runs-on: ubuntu-latest
181 environment: test-release
182 permissions:
183 id-token: write
184 steps:
185 - name: Download packages built by build-package
186 uses: actions/download-artifact@v6
187 with:
188 name: Packages
189 path: dist
190
191 - name: Upload package to Test PyPI
192 uses: pypa/gh-action-pypi-publish@release/v1
193 with:
194 repository-url: https://test.pypi.org/legacy/
195
196
197 publish:
198 if: >-
199 github.event_name == 'push' &&
200 github.repository == 'cleder/fastkml' &&
201 github.ref == 'refs/heads/main'
202 needs: [cpython, static-tests, pypy, cpython-lxml, doctest-lxml, build-package, graalpy]
203 name: Publish to PyPI on push to main
204 runs-on: ubuntu-latest
205 environment: release
206 permissions:
207 id-token: write
208 steps:
209 - name: Download packages built by build-package
210 uses: actions/download-artifact@v6
211 with:
212 name: Packages
213 path: dist
214
215 - name: Publish distribution 📦 to PyPI for push to main
216 uses: pypa/gh-action-pypi-publish@release/v1
217 ...