Repository navigation
130 lines (120 loc) · 5.06 KB
/
Copy pathpython-canary.yml
File metadata and controls
130 lines (120 loc) · 5.06 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
name: Next Python canary
# op-mcp supports one Python, the one in .python-version (#207). This nightly
# run tries the next one (.python-version's minor + 1) and shows when we can
# move, and what breaks before users hit it (#207: lupa had no 3.15 wheel):
#
# - wheels: resolve op-mcp's dependencies as a fresh `uvx op-mcp` would (the
# newest versions pyproject.toml allows), then require a ready-made wheel
# for every resolved package on Windows x64, macOS arm64, Linux x64 and
# arm64 (Intel Macs aren't supported: #230, ADR 0001 decision 6). A
# resolve with --only-binary alone isn't enough: it falls back to old
# versions that have wheels, which users wouldn't get;
# - unit tests on that Python, in a throwaway environment with those newest
# dependencies (not uv.lock's: its pins are chosen for the supported Python,
# and moving means refreshing it).
#
# Non-blocking: it runs only on a schedule and on demand, never on pull
# requests, so nothing waits for it. A failure turns the run red and the job
# summary says what failed; nothing else depends on it.
on:
schedule:
- cron: "53 4 * * *" # nightly, 04:53 UTC
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
canary:
name: Next Python
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: false
- name: Which Python is next
id: next
run: |
current=$(tr -d '[:space:]' < .python-version)
major=${current%%.*}
minor=${current#*.}
minor=${minor%%.*}
next="$major.$((minor + 1))"
echo "Supported: $current; next: $next"
{ echo "current=$current"; echo "next=$next"; } >> "$GITHUB_OUTPUT"
- name: Wheels for every platform
id: wheels
continue-on-error: true
env:
NEXT: ${{ steps.next.outputs.next }}
run: |
failed=0
{
echo "### Wheels on Python $NEXT"
echo
echo "| Platform | Result |"
echo "|---|---|"
} >> "$GITHUB_STEP_SUMMARY"
for platform in x86_64-pc-windows-msvc aarch64-apple-darwin \
x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
echo "::group::$platform"
if ! uv pip compile pyproject.toml --python-version "$NEXT" --python-platform "$platform" \
--quiet --output-file "resolved-$platform.txt" 2> "resolve-$platform.err"; then
cat "resolve-$platform.err"
result="does not resolve: $(grep -m1 -E 'Because|error' "resolve-$platform.err" | sed 's/|/\\|/g')"
failed=1
elif ! uv pip compile "resolved-$platform.txt" --no-deps --only-binary :all: \
--python-version "$NEXT" --python-platform "$platform" \
--quiet --output-file "wheels-$platform.txt" 2> "wheels-$platform.err"; then
cat "wheels-$platform.err"
# uv stops at the first package without a wheel.
missing=$(grep -oE '[A-Za-z0-9_.-]+==[^ ]+ has no usable wheels' "wheels-$platform.err" | head -1 | cut -d' ' -f1)
result="no wheel for ${missing:-a package (see the log)}"
failed=1
else
result="ok"
fi
echo "$platform: $result"
echo "| $platform | $result |" >> "$GITHUB_STEP_SUMMARY"
echo "::endgroup::"
done
exit "$failed"
- name: Unit tests
id: tests
continue-on-error: true
env:
NEXT: ${{ steps.next.outputs.next }}
run: |
echo "### Unit tests on Python $NEXT" >> "$GITHUB_STEP_SUMMARY"
uv venv --python "$NEXT" "$RUNNER_TEMP/canary"
if ! uv pip install --python "$RUNNER_TEMP/canary" ".[dev]"; then
echo "The dependencies don't install (see the log)." >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
status=0
"$RUNNER_TEMP/canary/bin/python" -m pytest -q -p no:cacheprovider | tee pytest.log || status=$?
{ echo; echo "\`$(tail -1 pytest.log)\`"; } >> "$GITHUB_STEP_SUMMARY"
exit "$status"
- name: Result
env:
CURRENT: ${{ steps.next.outputs.current }}
NEXT: ${{ steps.next.outputs.next }}
WHEELS: ${{ steps.wheels.outcome }}
TESTS: ${{ steps.tests.outcome }}
run: |
{
echo
echo "### Summary"
echo
echo "- Supported Python: $CURRENT; tried: $NEXT"
echo "- Wheels on every platform: $WHEELS"
echo "- Unit tests: $TESTS"
} >> "$GITHUB_STEP_SUMMARY"
if [ "$WHEELS" != success ] || [ "$TESTS" != success ]; then
echo "::warning title=Python $NEXT not ready::wheels: $WHEELS, unit tests: $TESTS (see the job summary). op-mcp stays on $CURRENT."
exit 1
fi
echo "Python $NEXT looks ready: dependencies have wheels everywhere and the unit tests pass."