@@ -14,20 +14,27 @@ jobs:
1414 runs-on : ubuntu-latest
1515 outputs :
1616 min-version : ${{ steps.resolve.outputs.min }}
17+ max-version : ${{ steps.resolve.outputs.max }}
1718 matrix : ${{ steps.resolve.outputs.matrix }}
1819 steps :
1920 - uses : actions/checkout@v4
2021
2122 - id : resolve
2223 run : |
23- MIN=$( python3 -c "
24- import re
24+ python3 << 'PYEOF' >> "$GITHUB_OUTPUT "
25+ import re, json
2526 with open('pyproject.toml') as f:
26- m = re.search(r'requires-python\s*=\s*\">=(\d+\.\d+)\"', f.read())
27- print(m.group(1) if m else '3.9')
28- ")
29- echo "min=$MIN" >> "$GITHUB_OUTPUT"
30- echo "matrix=[\"$MIN\", \"3.x\"]" >> "$GITHUB_OUTPUT"
27+ spec = re.search(r'requires-python\s*=\s*"([^"]+)"', f.read())
28+ spec = spec.group(1) if spec else '>=3.9'
29+ min_m = re.search(r'>=\s*([\d.]+)', spec)
30+ max_m = re.search(r'<=?\s*([\d.]+)', spec)
31+ min_v = min_m.group(1) if min_m else '3.9'
32+ max_v = max_m.group(1) if max_m else '3.x'
33+ matrix = [min_v, max_v] if min_v != max_v else [min_v]
34+ print(f'min={min_v}')
35+ print(f'max={max_v}')
36+ print(f'matrix={json.dumps(matrix)}')
37+ PYEOF
3138
3239 lint :
3340 needs : resolve-python
4148
4249 - uses : actions/setup-python@v5
4350 with :
44- python-version : " 3.x "
51+ python-version : ${{ needs.resolve-python.outputs.max-version }}
4552
4653 - run : uv sync --frozen --extra dev
4754
0 commit comments