-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpiwheels-arm32-verification.yml
More file actions
177 lines (152 loc) · 7 KB
/
Copy pathpiwheels-arm32-verification.yml
File metadata and controls
177 lines (152 loc) · 7 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
name: ARM32 Support Verification (piwheels)
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to check (e.g., 2.0.3)'
required: false
default: 'latest'
schedule:
- cron: '0 3 * * *' # Daily at 3 AM UTC
jobs:
verify-piwheels:
name: Verify ARM32 on piwheels
runs-on: ubuntu-latest
permissions:
contents: write # Required to push to development
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: development # Target development branch directly
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Wait for piwheels (if triggered by release)
if: github.event_name == 'release'
run: |
echo "⏳ Waiting 24 hours for piwheels to build ARM32 wheels..."
sleep 86400
- name: Get latest version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ github.event.inputs.version }}" != "latest" ]; then
VERSION="${{ github.event.inputs.version }}"
elif [ "${{ github.event_name }}" == "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
else
VERSION=$(curl -s https://pypi.org/pypi/omnipkg/json | python3 -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Checking version: $VERSION"
- name: Scrape piwheels simple index
id: scrape
run: |
VERSION="${{ steps.version.outputs.version }}"
SIMPLE_HTML=$(curl -s "https://www.piwheels.org/simple/omnipkg/")
if [ -z "$SIMPLE_HTML" ]; then
echo "builds_found=false" >> $GITHUB_OUTPUT
exit 0
fi
WHEELS=$(echo "$SIMPLE_HTML" | grep -oP "omnipkg-${VERSION}-[^\"']+\.whl" | sort -u)
if [ -z "$WHEELS" ]; then
echo "builds_found=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "builds_found=true" >> $GITHUB_OUTPUT
HAS_39=false; HAS_311=false; HAS_313=false
echo "$WHEELS" | grep -q "cp39" && HAS_39=true
echo "$WHEELS" | grep -q "cp311" && HAS_311=true
echo "$WHEELS" | grep -q "cp313" && HAS_313=true
PYTHON_VERSIONS=""
$HAS_39 && PYTHON_VERSIONS="${PYTHON_VERSIONS}3.9 (Bullseye), "
$HAS_311 && PYTHON_VERSIONS="${PYTHON_VERSIONS}3.11 (Bookworm), "
$HAS_313 && PYTHON_VERSIONS="${PYTHON_VERSIONS}3.13 (Trixie), "
PYTHON_VERSIONS="${PYTHON_VERSIONS%, }"
echo "python_versions=$PYTHON_VERSIONS" >> $GITHUB_OUTPUT
echo "has_cp39=$HAS_39" >> $GITHUB_OUTPUT
echo "has_cp311=$HAS_311" >> $GITHUB_OUTPUT
echo "has_cp313=$HAS_313" >> $GITHUB_OUTPUT
BEST_WHEEL=""
for ABI in cp311 cp313 cp39; do
CANDIDATE=$(echo "$WHEELS" | grep "${ABI}-${ABI}-linux_armv7l" | head -1)
if [ -z "$CANDIDATE" ]; then
CANDIDATE=$(echo "$WHEELS" | grep "${ABI}-${ABI}-linux_armv6l" | head -1)
fi
if [ -n "$CANDIDATE" ]; then
BEST_WHEEL="$CANDIDATE"
break
fi
done
[ -z "$BEST_WHEEL" ] && BEST_WHEEL=$(echo "$WHEELS" | head -1)
echo "wheel_file=$BEST_WHEEL" >> $GITHUB_OUTPUT
echo "wheel_url=https://www.piwheels.org/simple/omnipkg/${BEST_WHEEL}" >> $GITHUB_OUTPUT
echo "install_command=pip3 install omnipkg==${VERSION}" >> $GITHUB_OUTPUT
- name: Update README and Matrix
if: steps.scrape.outputs.builds_found == 'true'
run: |
VERSION="${{ steps.version.outputs.version }}"
PYTHON_VERS="${{ steps.scrape.outputs.python_versions }}"
INSTALL_CMD="${{ steps.scrape.outputs.install_command }}"
WHEEL_URL="${{ steps.scrape.outputs.wheel_url }}"
cat > .github/piwheels-stats.md <<EOF
<!-- PIWHEELS_STATS_START -->
## 🥧 ARM32 Support (Raspberry Pi)
[](https://www.piwheels.org/project/omnipkg/)
**Latest Version:** \`$VERSION\` | **Python:** $PYTHON_VERS | [View on piwheels](https://www.piwheels.org/project/omnipkg/)
\`\`\`bash
$INSTALL_CMD
\`\`\`
**Verified Platforms:**
- 🍓 Raspberry Pi (armv6/armv7) - Bullseye, Bookworm, Trixie
- 📦 Wheel: [\`$WHEEL_URL\`]($WHEEL_URL)
<!-- PIWHEELS_STATS_END -->
EOF
if grep -q "<!-- PIWHEELS_STATS_START -->" README.md; then
perl -i -p0e 's/<!-- PIWHEELS_STATS_START -->.*?<!-- PIWHEELS_STATS_END -->//gs' README.md
sed -i '/#### 🥧 piwheels (for Raspberry Pi)/r .github/piwheels-stats.md' README.md
fi
cat > .github/platform-matrix.json <<EOF
{
"arm32": {
"verified": true,
"version": "$VERSION",
"python_versions": "$PYTHON_VERS",
"cp39_bullseye": ${{ steps.scrape.outputs.has_cp39 }},
"cp311_bookworm": ${{ steps.scrape.outputs.has_cp311 }},
"cp313_trixie": ${{ steps.scrape.outputs.has_cp313 }},
"install_command": "$INSTALL_CMD",
"platforms": ["Raspberry Pi", "Raspbian Bullseye", "Raspbian Bookworm", "Raspbian Trixie"]
}
}
EOF
- name: Auto-Commit to Development
if: steps.scrape.outputs.builds_found == 'true'
run: |
VERSION="${{ steps.version.outputs.version }}"
# Use the same bot identity as your working Auto-merge workflow
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md .github/piwheels-stats.md .github/platform-matrix.json
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
# Commit and push directly to development
git commit -m "docs: update ARM32 piwheels stats for v$VERSION [skip ci]"
# Pull with rebase to avoid conflicts if other bots are working
git pull origin development --rebase || true
git push origin development
echo "✅ Successfully pushed stats to development. Auto-merge workflow will take it to main."
- name: Summary
if: steps.scrape.outputs.builds_found == 'true'
run: |
echo "## ARM32 Check Complete" >> $GITHUB_STEP_SUMMARY
echo "Version: ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "Status: Wheels found and pushed to development branch." >> $GITHUB_STEP_SUMMARY