Repository navigation
78 lines (75 loc) · 2.74 KB
/
Copy pathpython-versions.yml
File metadata and controls
78 lines (75 loc) · 2.74 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
name: Python compatibility check
on:
push:
branches: [ "main" ]
paths:
- '**/pyproject.toml'
- 'uv.lock'
- 'dev.py'
- '.github/workflows/python-versions.yml'
pull_request:
branches: [ "**" ]
paths:
- '**/pyproject.toml'
- 'uv.lock'
- 'dev.py'
- '.github/workflows/python-versions.yml'
concurrency:
group: python-compatibility-${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
# One job for every version: each only resolves (`uv pip compile`), and the setup took most
# of each job's time when there was a job per version. Versions resolve two at a time, each
# into its own log so their output does not interleave. Every version is checked even after
# one fails, and the job fails at the end, naming the versions that did not resolve.
resolve:
name: Resolve on Python 3.10–3.14
runs-on: ubuntu-latest
env:
PYTHON_VERSIONS: "3.10 3.11 3.12 3.13 3.14"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/python-uv-setup
with:
sync-flags: "--frozen --only-group dev"
- name: Resolve every workspace member on each Python version
id: resolve
run: |
read -ra versions <<< "$PYTHON_VERSIONS"
printf '%s\n' "${versions[@]}" | xargs -P 2 -n 1 bash -c '
version=$1
uv run --no-sync dev.py check-python-versions "$version" > "$RUNNER_TEMP/python-$version.log" 2>&1
echo "$?" > "$RUNNER_TEMP/python-$version.status"
' _
failed=()
for version in "${versions[@]}"; do
if [[ $(cat "$RUNNER_TEMP/python-$version.status") != 0 ]]; then
failed+=("$version")
fi
done
if (( ${#failed[@]} )); then
echo "::error::Did not resolve on Python ${failed[*]}"
exit 1
fi
# Its own step, so the logs show even when the resolve step fails, is cancelled or times
# out: a version that never finished shows how far it got.
- name: Show each version's resolver output
if: always() && steps.resolve.outcome != 'skipped'
run: |
read -ra versions <<< "$PYTHON_VERSIONS"
for version in "${versions[@]}"; do
log="$RUNNER_TEMP/python-$version.log"
if [[ ! -f $log ]]; then
echo "Python $version: did not start"
elif [[ ! -f $RUNNER_TEMP/python-$version.status ]]; then
echo "Python $version: did not finish; its output so far:"
cat "$log"
else
cat "$log"
fi
done