ARM32 Support Verification (piwheels) #299
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |