-
Notifications
You must be signed in to change notification settings - Fork 0
600 lines (502 loc) · 20.1 KB
/
test-python-setup-pip.yml
File metadata and controls
600 lines (502 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
name: Test python-setup/pip
on:
push:
jobs:
test-pip-basic:
name: Test pip action - defaults
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Test pip action with defaults (cache='')
uses: ./actions/python-setup/pip
- name: Verify Python installation
run: |
python --version
pip --version
pip list
test-pip-with-groups:
name: Test pip action - With optional dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-with-groups/pyproject.toml .
- name: Test pip action with optional dependencies (extras)
uses: ./actions/python-setup/pip
with:
install-groups: 'extras: dev test'
- name: Verify installations
shell: bash
run: |
python --version
pip list
# Verify dev dependencies are installed
python -c "import pytest; import black; print('[OK] Dev dependencies installed')"
python -c "import pytest_cov; print('[OK] Test dependencies installed')"
test-pip-matrix:
name: Test pip action - Matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
shell: bash
run: cp tests/data/pip/test-pip-matrix/pyproject.toml .
- name: Test pip action with Python ${{ matrix.python-version }}
uses: ./actions/python-setup/pip
with:
python-version: ${{ matrix.python-version }}
- name: Verify Python version
run: |
python --version
python -c "import sys; assert sys.version_info[:2] == tuple(map(int, '${{ matrix.python-version }}'.split('.')[:2]))"
pip list
- name: Test pip functionality
shell: bash
run: |
pip install requests
python -c "import requests; print(f'[OK] requests {requests.__version__} installed successfully')"
test-pip-cache:
name: Test pip action - Cache validation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-cache/pyproject.toml .
- name: First run - populate cache
uses: ./actions/python-setup/pip
with:
cache: 'pip'
- name: Verify cache is working
run: |
pip list
echo "Cache should be populated for subsequent runs"
test-pip-architecture:
name: Test pip action - Architecture
runs-on: windows-latest
strategy:
matrix:
architecture: [x64, x86]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
shell: bash
run: cp tests/data/pip/test-pip-architecture/pyproject.toml .
- name: Test pip action with ${{ matrix.architecture }}
uses: ./actions/python-setup/pip
with:
architecture: ${{ matrix.architecture }}
- name: Verify architecture
run: |
python --version
python -c "import platform; print(f'Architecture: {platform.architecture()}')"
test-pip-cache-validation-error:
name: Test pip action - Cache validation error
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Test pip action with cache but no dependency file (should fail)
id: test-cache-error
continue-on-error: true
uses: ./actions/python-setup/pip
with:
cache: 'pip'
- name: Verify action failed as expected
shell: bash
run: |
if [ "${{ steps.test-cache-error.outcome }}" != "failure" ]; then
echo "::error::Expected action to fail when cache is enabled without pyproject.toml/requirements.txt"
exit 1
fi
echo "[OK] Action correctly failed when cache enabled without dependency files"
test-pip-cache-with-requirements:
name: Test pip action - Cache with requirements.txt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-cache-with-requirements/requirements.txt .
- name: Test pip action with cache and requirements.txt
uses: ./actions/python-setup/pip
with:
cache: 'pip'
- name: Verify cache validation passed
shell: bash
run: |
python --version
pip list
echo "[OK] Cache validation passed with requirements.txt"
test-pip-no-dependency-file:
name: Test pip action - No dependency files (no cache)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Test pip action without pyproject.toml or requirements.txt
uses: ./actions/python-setup/pip
- name: Verify Python still works
shell: bash
run: |
python --version
pip --version
pip install requests
python -c "import requests; print('[OK] Can still install packages without dependency files')"
test-pip-empty-sections:
name: Test pip action - Empty groups/extras sections
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-empty-sections/pyproject.toml .
- name: Test pip action with empty groups section
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: , extras: aws'
- name: Verify empty groups handling
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import boto3; print('[OK] AWS extra installed')"
test-pip-invalid-format:
name: Test pip action - Invalid format handling
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-invalid-format/pyproject.toml .
- name: Test pip action with invalid format (should show warning)
uses: ./actions/python-setup/pip
with:
install-groups: 'invalid format without colons'
- name: Verify warning shown and core dependencies installed
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed despite invalid format')"
test-pip-optional-dependencies:
name: Test pip action - Optional dependencies (extras)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-optional-dependencies/pyproject.toml .
- name: Test pip action with optional dependencies only
uses: ./actions/python-setup/pip
with:
install-groups: 'extras: aws viz'
- name: Verify optional dependencies installed
shell: bash
run: |
pip list
# Verify core dependencies are installed
python -c "import requests; print('[OK] Core dependencies installed')"
# Verify optional dependencies are installed
python -c "import boto3; print('[OK] AWS extra installed')"
python -c "import matplotlib; print('[OK] Viz extra installed')"
# Verify dependency groups are NOT installed (no -group support in older pip)
if python -c "import httpx" 2>/dev/null; then
echo "[OK] httpx found - dependency groups may be supported"
else
echo "::error::Dev group not installed - pip version does not support --group"
fi
test-pip-mixed-groups-and-extras:
name: Test pip action - Mixed groups and extras
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-mixed-groups-and-extras/pyproject.toml .
- name: Test pip action with mixed groups and extras
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: dev, extras: aws'
- name: Verify mixed installation
shell: bash
run: |
pip list
# Verify all requested dependencies are installed
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import boto3; print('[OK] AWS extra installed')"
# Dev group installation depends on pip version support for --group
if python -c "import httpx" 2>/dev/null; then
echo "[OK] Dev group installed (pip supports --group)"
else
echo "::error::Dev group not installed - pip version does not support --group"
exit 1
fi
test-pip-dependency-groups-only:
name: Test pip action - Dependency groups only
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-dependency-groups-only/pyproject.toml .
- name: Test pip action with dependency groups only
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: dev test'
- name: Verify dependency groups installation
shell: bash
run: |
pip list
# Verify core dependencies are installed
python -c "import requests; print('[OK] Core dependencies installed')"
# Dependency group installation depends on pip version
if python -c "import httpx; import pytest" 2>/dev/null; then
echo "[OK] Dependency groups installed (pip supports PEP 735)"
else
echo "[OK] Dependency groups not installed (pip version does not support PEP 735 --dependency-groups)"
echo "[INFO] This is expected for older pip versions. Consider using uv action for dependency groups support."
fi
test-pip-groups-docs-only:
name: Test pip action - Single dependency group (docs)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-groups-only-docs/pyproject.toml .
- name: Test pip action with docs dependency group
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: docs'
- name: Verify installation and expected warning
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
# This test verifies the warning behavior when pip doesn't support --dependency-groups
if python -c "import mkdocs" 2>/dev/null; then
echo "[OK] Docs group installed (pip supports PEP 735)"
else
echo "[OK] Docs group not installed - this is expected with current pip version"
echo "[INFO] The warning message 'pip version does not support --dependency-groups' is expected"
fi
test-pip-all-combinations:
name: Test pip action - All combinations (groups + extras)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-all-combinations/pyproject.toml .
- name: Test pip action with multiple groups and extras
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: dev test docs, extras: aws azure gcp'
- name: Verify comprehensive installation
shell: bash
run: |
pip list
# Verify core dependencies
python -c "import requests; import click; print('[OK] Core dependencies installed')"
# Verify optional dependencies (extras)
python -c "import boto3; print('[OK] AWS extra installed')"
python -c "from azure.storage.blob import BlobServiceClient; print('[OK] Azure extra installed')"
python -c "from google.cloud import storage; print('[OK] GCP extra installed')"
# Verify dependency groups (if supported)
if python -c "import httpx; import pytest; import mkdocs" 2>/dev/null; then
echo "[OK] All dependency groups installed (pip supports PEP 735)"
else
echo "[OK] Dependency groups not installed (pip doesn't support PEP 735)"
fi
test-pip-single-extra:
name: Test pip action - Single extra only
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-single-extra/pyproject.toml .
- name: Test pip action with single extra
uses: ./actions/python-setup/pip
with:
install-groups: 'extras: dev'
- name: Verify single extra installation
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import pytest; import black; import ruff; print('[OK] Dev extra installed')"
test-pip-single-group:
name: Test pip action - Single group only
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-single-group/pyproject.toml .
- name: Test pip action with single group
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: dev'
- name: Verify single group installation
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
if python -c "import pytest; import black; import ruff" 2>/dev/null; then
echo "[OK] Dev group installed (pip supports PEP 735)"
else
echo "[OK] Dev group not installed (pip doesn't support PEP 735)"
fi
test-pip-only-core-dependencies:
name: Test pip action - Only core dependencies (no groups/extras)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-only-dependencies/pyproject.toml .
- name: Test pip action without install-groups parameter
uses: ./actions/python-setup/pip
- name: Verify only core dependencies installed
shell: bash
run: |
pip list
python -c "import requests; import click; import httpx; print('[OK] Core dependencies installed')"
echo "[OK] Only core dependencies installed as expected"
test-pip-whitespace-handling:
name: Test pip action - Whitespace handling in groups/extras
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-whitespace-handling/pyproject.toml .
- name: Test pip action with extra whitespace
uses: ./actions/python-setup/pip
with:
install-groups: ' groups: lint format , extras: dev test '
- name: Verify whitespace handling
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import pytest; print('[OK] Dev extra installed')"
python -c "import pytest_cov; print('[OK] Test extra installed')"
if python -c "import ruff; import black" 2>/dev/null; then
echo "[OK] Groups installed with whitespace handling (pip supports PEP 735)"
else
echo "[OK] Groups not installed (pip doesn't support PEP 735)"
fi
test-pip-empty-groups-value:
name: Test pip action - Empty groups value
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-empty-groups-only/pyproject.toml .
- name: Test pip action with empty groups value
uses: ./actions/python-setup/pip
with:
install-groups: 'groups: '
- name: Verify empty groups handling
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
echo "[OK] Empty groups value handled correctly"
test-pip-empty-extras-value:
name: Test pip action - Empty extras value
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-empty-extras-only/pyproject.toml .
- name: Test pip action with empty extras value
uses: ./actions/python-setup/pip
with:
install-groups: 'extras: '
- name: Verify empty extras handling
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
echo "[OK] Empty extras value handled correctly"
test-pip-python-version-matrix:
name: Test pip action - Python version matrix with extras
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13']
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-multiple-python-versions/pyproject.toml .
- name: Test pip action with Python ${{ matrix.python-version }}
uses: ./actions/python-setup/pip
with:
python-version: ${{ matrix.python-version }}
install-groups: 'extras: dev'
- name: Verify Python version and extras
shell: bash
run: |
python --version
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import pytest; print('[OK] Dev extra installed')"
test-pip-reverse-order:
name: Test pip action - Reverse order (extras before groups)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-all-combinations/pyproject.toml .
- name: Test pip action with extras before groups
uses: ./actions/python-setup/pip
with:
install-groups: 'extras: aws, groups: dev'
- name: Verify reverse order handling
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import boto3; print('[OK] AWS extra installed')"
if python -c "import httpx" 2>/dev/null; then
echo "[OK] Dev group installed (pip supports PEP 735)"
else
echo "::error::Dev group not installed - pip doesn't support PEP 735"
exit 1
fi
test-pip-cache-with-groups:
name: Test pip action - Cache with groups and extras
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy test fixture files
run: cp tests/data/pip/test-pip-all-combinations/pyproject.toml .
- name: Test pip action with cache and install-groups
uses: ./actions/python-setup/pip
with:
cache: 'pip'
install-groups: 'groups: dev, extras: aws'
- name: Verify cache and installation
shell: bash
run: |
pip list
python -c "import requests; print('[OK] Core dependencies installed')"
python -c "import boto3; print('[OK] AWS extra installed with cache')"
echo "[OK] Cache validation passed with groups and extras"