@@ -11,116 +11,195 @@ jobs:
11
11
test :
12
12
strategy :
13
13
matrix :
14
- python : [ "3.8 ", "3.9 ", "3.10 ", "3.11 " ]
14
+ python : [ "3.9 ", "3.10 ", "3.11 ", "3.12", "3.13 " ]
15
15
os : [ ubuntu-latest, macos-latest, windows-latest ]
16
16
runs-on : ${{ matrix.os }}
17
17
steps :
18
- - uses : actions/checkout@v3
18
+ - uses : actions/checkout@v4.2.2
19
19
- name : Set up Python
20
- uses : actions/setup-python@v4
20
+ uses : actions/setup-python@v5.3.0
21
21
with :
22
22
python-version : ${{ matrix.python }}
23
23
24
24
- name : Get Python Version
25
25
id : get_python_version
26
26
run : echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
27
+ shell : bash
27
28
28
29
- name : Cache dependencies
29
- uses : actions/cache@v3
30
+ uses : actions/cache@v4
30
31
with :
31
32
path : .venv
32
- key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry .lock') }}
33
+ key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm .lock') }}
33
34
restore-keys : |
34
35
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies
35
- - name : Install Poetry
36
- run : pip install poetry
36
+ - name : Install PDM
37
+ run : pip install pdm
37
38
38
- - name : Create Virtual Environment
39
- run : python -m venv .venv
39
+ - name : Install Dependencies
40
+ run : pdm install
40
41
41
- - name : Upgrade pip
42
- run : poetry run python -m pip install --upgrade pip
42
+ - name : Check formatting
43
+ run : pdm run ruff format . --check
43
44
44
- - name : Install Dependencies
45
- run : poetry install
45
+ - name : Run mypy
46
+ run : pdm mypy --show-error-codes
46
47
47
- - name : Run Black
48
- run : poetry run black . -- check
48
+ - name : Lint
49
+ run : pdm run ruff check .
49
50
50
- - name : Run isort
51
- run : poetry run isort . --check
51
+ - name : Run pytest without coverage
52
+ if : matrix.os != 'ubuntu-latest'
53
+ run : pdm test
52
54
53
- - name : Run safety
54
- run : poetry export -f requirements.txt | poetry run safety check --bare --stdin
55
+ - name : Run pytest with coverage
56
+ if : matrix.os == 'ubuntu-latest'
57
+ run : pdm test_with_coverage
55
58
56
- - name : Run mypy
57
- run : poetry run mypy --show-error-codes openapi_python_client
59
+ - run : mv .coverage .coverage.${{ matrix.python }}
60
+ if : matrix.os == 'ubuntu-latest'
58
61
59
- - name : Run pylint
60
- run : poetry run pylint openapi_python_client
62
+ - name : Store coverage report
63
+
64
+ if : matrix.os == 'ubuntu-latest'
65
+ with :
66
+ name : coverage-${{ matrix.python }}
67
+ path : .coverage.${{ matrix.python }}
68
+ if-no-files-found : error
69
+ include-hidden-files : true
61
70
62
- - name : Run pytest
63
- run : poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp
64
- env :
65
- TASKIPY : true
71
+ test_min_deps :
72
+ strategy :
73
+ matrix :
74
+ os : [ ubuntu-latest, macos-latest, windows-latest ]
75
+ runs-on : ${{ matrix.os }}
76
+ steps :
77
+
78
+ - name : Set up Python
79
+
80
+ with :
81
+ python-version : " 3.9"
66
82
67
- - name : Generate coverage report
83
+ - name : Get Python Version
84
+ id : get_python_version
85
+ run : echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
68
86
shell : bash
69
- run : poetry run coverage xml
70
87
71
- - uses : codecov/codecov-action@v3
88
+ - name : Cache dependencies
89
+ uses : actions/cache@v4
90
+ with :
91
+ path : .venv
92
+ key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-min-dependencies-${{ hashFiles('**/pdm.lock') }}
93
+ restore-keys : |
94
+ ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-min-dependencies
95
+ - name : Install PDM
96
+ run : pip install pdm
97
+
98
+ - name : Install minimum dependencies
99
+ run : pdm install -L pdm.minimal.lock
100
+
101
+ - name : Run mypy
102
+ run : pdm mypy --show-error-codes
103
+
104
+ - name : Lint
105
+ run : pdm run ruff check .
106
+
107
+ - name : Run unit tests only # snapshots are expected to fail
108
+ run : pdm unit_test
109
+
110
+ coverage :
111
+ name : Combine & check coverage
112
+ needs : test
113
+ runs-on : ubuntu-latest
114
+ steps :
115
+
116
+ - uses : actions/setup-python@v5
72
117
with :
73
- files : ./coverage.xml
118
+ python-version : " 3.12"
119
+ - name : Download coverage reports
120
+
121
+ with :
122
+ merge-multiple : true
123
+
124
+ - name : Create Virtual Environment
125
+ run : python -m venv .venv
126
+
127
+ - name : Combine coverage & fail if it's <100%.
128
+ run : |
129
+ # Install coverage
130
+ .venv/bin/pip install --upgrade coverage[toml]
131
+
132
+ # Find all of the downloaded coverage reports and combine them
133
+ .venv/bin/python -m coverage combine
134
+
135
+ # Create html report
136
+ .venv/bin/python -m coverage html --skip-covered --skip-empty
137
+
138
+ # Report in Markdown and write to summary.
139
+ .venv/bin/python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
140
+
141
+ # Report again and fail if under 100%.
142
+ .venv/bin/python -m coverage report --fail-under=100
143
+
144
+ - name : Upload HTML report if check failed.
145
+
146
+ with :
147
+ name : html-report
148
+ path : htmlcov
149
+ if : ${{ failure() }}
74
150
75
151
integration :
76
152
name : Integration Tests
77
153
runs-on : ubuntu-latest
154
+ strategy :
155
+ matrix :
156
+ httpx_version :
157
+ - " 0.20.0"
158
+ - " "
78
159
services :
79
160
openapi-test-server :
80
161
image : ghcr.io/openapi-generators/openapi-test-server:0.0.1
81
162
ports :
82
163
- " 3000:3000"
83
164
steps :
84
- - uses : actions/checkout@v3
165
+ - uses : actions/checkout@v4.2.2
85
166
- name : Set up Python
86
- uses : actions/setup-python@v4
167
+ uses : actions/setup-python@v5.3.0
87
168
with :
88
- python-version : " 3.10 "
169
+ python-version : " 3.9 "
89
170
- name : Get Python Version
90
171
id : get_python_version
91
172
run : echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
92
173
- name : Cache dependencies
93
- uses : actions/cache@v3
174
+ uses : actions/cache@v4
94
175
with :
95
176
path : .venv
96
- key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry .lock') }}
177
+ key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm .lock') }}
97
178
restore-keys : |
98
179
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies
99
180
- name : Install dependencies
100
181
run : |
101
- pip install poetry
182
+ pip install pdm
102
183
python -m venv .venv
103
- poetry run python -m pip install --upgrade pip
104
- poetry install
105
- - name : Regenerate Integration Client
106
- run : |
107
- poetry run openapi-python-client update --url http://localhost:3000/openapi.json --config integration-tests-config.yaml
108
- - name : Check for any file changes
109
- run : python .github/check_for_changes.py
184
+ pdm install
110
185
- name : Cache Generated Client Dependencies
111
- uses : actions/cache@v3
186
+ uses : actions/cache@v4
112
187
with :
113
188
path : integration-tests/.venv
114
- key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/poetry .lock') }}
189
+ key : ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/pdm .lock') }}
115
190
restore-keys : |
116
191
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies
192
+ - name : Set httpx version
193
+ if : matrix.httpx_version != ''
194
+ run : |
195
+ cd integration-tests
196
+ pdm add httpx==${{ matrix.httpx_version }}
117
197
- name : Install Integration Dependencies
118
198
run : |
119
199
cd integration-tests
120
- python -m venv .venv
121
- poetry run python -m pip install --upgrade pip
122
- poetry install
200
+ pdm install
123
201
- name : Run Tests
124
202
run : |
125
203
cd integration-tests
126
- poetry run pytest
204
+ pdm run pytest
205
+ pdm run mypy . --strict
0 commit comments