@@ -63,34 +63,64 @@ jobs:
6363 path : dist/
6464
6565 test :
66- timeout-minutes : 20
67- name : test
68- runs-on : ubuntu-latest
66+ timeout-minutes : 30
67+ name : test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
68+ runs-on : ${{ matrix.os }}
6969 needs : [lint, build]
70+ strategy :
71+ matrix :
72+ os : [ubuntu-latest, windows-latest, macos-latest]
73+ python-version : ["3.8", "3.9", "3.10", "3.11", "3.12"]
74+ fail-fast : false
7075 steps :
7176 - uses : actions/checkout@v4
7277
73- - name : Install Rye
78+ - name : Install Rye (Unix)
79+ if : runner.os != 'Windows'
7480 run : |
7581 curl -sSf https://rye.astral.sh/get | bash
7682 echo "$HOME/.rye/shims" >> $GITHUB_PATH
7783 env :
7884 RYE_VERSION : ' 0.44.0'
7985 RYE_INSTALL_OPTION : ' --yes'
8086
81- - name : Install dependencies
87+ - name : Install Rye (Windows)
88+ if : runner.os == 'Windows'
89+ run : |
90+ Invoke-WebRequest -Uri "https://github.com/astral-sh/rye/releases/download/0.44.0/rye-x86_64-windows.exe" -OutFile "rye-installer.exe"
91+ .\rye-installer.exe --yes
92+ echo "$env:USERPROFILE\.rye\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
93+ shell : powershell
94+
95+ - name : Configure Rye Python version
96+ run : rye pin ${{ matrix.python-version }}
97+
98+ - name : Install dependencies (Unix)
99+ if : runner.os != 'Windows'
82100 run : make install-dev
101+
102+ - name : Install dependencies (Windows)
103+ if : runner.os == 'Windows'
104+ run : |
105+ rye sync --all-features
83106
84107 - name : Download build artifacts
85108 uses : actions/download-artifact@v4
86109 with :
87110 name : dist
88111 path : dist/
89112
90- - name : Run tests with coverage
113+ - name : Run tests with coverage (Unix)
114+ if : runner.os != 'Windows'
91115 run : make test
116+
117+ - name : Run tests with coverage (Windows)
118+ if : runner.os == 'Windows'
119+ run : |
120+ rye run pytest tests/ -v --cov=evolution_openai --cov-report=html --cov-report=term --cov-report=xml:coverage.xml --cov-report=json:coverage.json
92121
93- - name : Upload coverage artifacts
122+ - name : Upload coverage artifacts (Ubuntu only)
123+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
94124 uses : actions/upload-artifact@v4
95125 with :
96126 name : coverage
@@ -154,56 +184,124 @@ jobs:
154184
155185 test-examples :
156186 timeout-minutes : 20
157- name : test-examples
158- runs-on : ubuntu-latest
187+ name : test-examples (Python ${{ matrix.python-version }}, ${{ matrix.os }})
188+ runs-on : ${{ matrix.os }}
159189 needs : [test]
160190 if : github.event_name == 'pull_request' && github.base_ref == 'main' || github.event_name == 'push' && github.ref == 'refs/heads/main'
191+ strategy :
192+ matrix :
193+ os : [ubuntu-latest, windows-latest, macos-latest]
194+ python-version : ["3.10", "3.12"] # Тестируем примеры только на двух версиях для экономии ресурсов
195+ fail-fast : false
161196 steps :
162197 - uses : actions/checkout@v4
163198
164- - name : Install Rye
199+ - name : Install Rye (Unix)
200+ if : runner.os != 'Windows'
165201 run : |
166202 curl -sSf https://rye.astral.sh/get | bash
167203 echo "$HOME/.rye/shims" >> $GITHUB_PATH
168204 env :
169205 RYE_VERSION : ' 0.44.0'
170206 RYE_INSTALL_OPTION : ' --yes'
171207
172- - name : Install dependencies
208+ - name : Install Rye (Windows)
209+ if : runner.os == 'Windows'
210+ run : |
211+ Invoke-WebRequest -Uri "https://github.com/astral-sh/rye/releases/download/0.44.0/rye-x86_64-windows.exe" -OutFile "rye-installer.exe"
212+ .\rye-installer.exe --yes
213+ echo "$env:USERPROFILE\.rye\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
214+ shell : powershell
215+
216+ - name : Configure Rye Python version
217+ run : rye pin ${{ matrix.python-version }}
218+
219+ - name : Install dependencies (Unix)
220+ if : runner.os != 'Windows'
173221 run : make install-dev
222+
223+ - name : Install dependencies (Windows)
224+ if : runner.os == 'Windows'
225+ run : rye sync --all-features
174226
175- - name : Run basic examples
227+ - name : Run basic examples (Unix)
228+ if : runner.os != 'Windows'
176229 env :
177230 EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
178231 EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
179232 EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
180233 run : make run-examples
234+
235+ - name : Run basic examples (Windows)
236+ if : runner.os == 'Windows'
237+ env :
238+ EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
239+ EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
240+ EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
241+ run : rye run python examples/basic_usage.py
181242
182- - name : Run async examples
243+ - name : Run async examples (Unix)
244+ if : runner.os != 'Windows'
183245 env :
184246 EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
185247 EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
186248 EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
187249 run : make run-async
250+
251+ - name : Run async examples (Windows)
252+ if : runner.os == 'Windows'
253+ env :
254+ EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
255+ EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
256+ EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
257+ run : rye run python examples/async_examples.py
188258
189- - name : Run streaming examples
259+ - name : Run streaming examples (Unix)
260+ if : runner.os != 'Windows'
190261 env :
191262 EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
192263 EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
193264 EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
194265 run : make run-streaming
266+
267+ - name : Run streaming examples (Windows)
268+ if : runner.os == 'Windows'
269+ env :
270+ EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
271+ EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
272+ EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
273+ run : rye run python examples/streaming_examples.py
195274
196- - name : Run token management examples
275+ - name : Run token management examples (Unix)
276+ if : runner.os != 'Windows'
197277 env :
198278 EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
199279 EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
200280 EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
201281 run : make run-tokens
282+
283+ - name : Run token management examples (Windows)
284+ if : runner.os == 'Windows'
285+ env :
286+ EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
287+ EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
288+ EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
289+ run : rye run python examples/token_management.py
202290
203- - name : Run foundation models examples
291+ - name : Run foundation models examples (Unix)
292+ if : runner.os != 'Windows'
293+ env :
294+ EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
295+ EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
296+ EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
297+ EVOLUTION_PROJECT_ID : ${{ secrets.EVOLUTION_PROJECT_ID }}
298+ run : make run-foundation-models
299+
300+ - name : Run foundation models examples (Windows)
301+ if : runner.os == 'Windows'
204302 env :
205303 EVOLUTION_KEY_ID : ${{ secrets.EVOLUTION_KEY_ID }}
206304 EVOLUTION_SECRET : ${{ secrets.EVOLUTION_SECRET }}
207305 EVOLUTION_BASE_URL : ${{ secrets.EVOLUTION_BASE_URL }}
208306 EVOLUTION_PROJECT_ID : ${{ secrets.EVOLUTION_PROJECT_ID }}
209- run : make run-foundation-models
307+ run : rye run python examples/foundation_models_example.py
0 commit comments