-
-
Notifications
You must be signed in to change notification settings - Fork 13
93 lines (76 loc) · 2.63 KB
/
ci-supported-pythons.yml
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
---
name: Use JSON output to build job matrix
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
FORCE_COLOR: "1" # Make tools pretty.
jobs:
build-package:
name: Build & verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: hynek/structlog
path: structlog
fetch-depth: 0
- uses: actions/checkout@v4
with:
path: action
- uses: ./action
id: baipp
with:
path: structlog
outputs:
package-version: ${{ steps.baipp.outputs.package_version }}
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
# If your matrix consists only of Python versions, you can use the
# following, too:
# python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_job_matrix_value }}
test-supported-pythons:
needs: build-package
runs-on: ubuntu-latest
strategy:
matrix:
# Create matrix from the 'python-versions' output from the build-package
# job.
python-version: ${{ fromJson(needs.build-package.outputs.python-versions) }}
# If you set 'python-versions' to
# 'supported_python_classifiers_json_job_matrix_value'
# above, you would set the matrix like this instead:
# matrix: ${{ fromJson(needs.build-package.outputs.python-versions) }}
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Download built packages from the build-package job.
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Prepare tests & config
run: |
# We use tox together with the fast tox-uv plugin.
python -Im pip install tox-uv
# Unpack SDist for tests & config files.
tar xf dist/*.tar.gz --strip-components=1
# Ensure tests run against wheel.
rm -rf src
# To conserve CI resources, we've commented the next step out to not
# actually run the tests. Just remove the 'echo' to run them.
- name: Run tox environments for ${{ matrix.python-version }}
run: echo python -Im tox run --installpkg dist/*.whl -f py$(echo ${{ matrix.python-version }} | tr -d .)
test-package-version:
needs: build-package
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: |
echo "Package version: ${{ needs.build-package.outputs.package-version }}"
...