Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 72 additions & 7 deletions .github/workflows/build-wheels-defined.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ on:
type: boolean
required: false
default: true
os_linux_armv7_legacy:
description: Build on linux armv7 legacy (bullseye, glibc 2.31)
type: boolean
required: false
default: false

env:
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -86,7 +91,7 @@ jobs:
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-ubuntu-${{ matrix.python-version }}
name: wheels-download-directory-linux-x86_64-${{ matrix.python-version }}
path: ./downloaded_wheels


Expand Down Expand Up @@ -123,7 +128,7 @@ jobs:
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-windows-${{ matrix.python-version }}
name: wheels-download-directory-windows-x86_64-${{ matrix.python-version }}
path: ./downloaded_wheels


Expand Down Expand Up @@ -165,7 +170,7 @@ jobs:
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-macos-x86-${{ matrix.python-version }}
name: wheels-download-directory-macos-x86_64-${{ matrix.python-version }}
path: ./downloaded_wheels


Expand Down Expand Up @@ -246,6 +251,7 @@ jobs:
-w /work \
-e GH_TOKEN="${GH_TOKEN}" \
-e PIP_NO_CACHE_DIR=1 \
-e LDFLAGS="-Wl,-z,max-page-size=0x1000" \
python:${{ matrix.python-version }}-bookworm \
bash -c "
set -e
Expand All @@ -262,7 +268,7 @@ jobs:
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-linux-arm7-${{ matrix.python-version }}
name: wheels-download-directory-linux-armv7-${{ matrix.python-version }}
path: ./downloaded_wheels


Expand Down Expand Up @@ -301,17 +307,76 @@ jobs:
name: wheels-download-directory-linux-arm64-${{ matrix.python-version }}
path: ./downloaded_wheels


linux-armv7-legacy:
needs: get-supported-versions
name: linux aarch32 (armv7 legacy)
if: ${{ inputs.os_linux_armv7_legacy }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
exclude:
# Python 3.14 doesn't have bullseye images for ARM
- python-version: '3.14'
steps:
- name: Set up QEMU for ARMv7
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm/v7

- name: Checkout repository
uses: actions/checkout@v4

- name: Build wheels - ARMv7 Legacy (in Docker)
# Build on Bullseye (glibc 2.31) for compatibility with older systems
run: |
docker run --rm --platform linux/arm/v7 \
-v $(pwd):/work \
-w /work \
-e GH_TOKEN="${GH_TOKEN}" \
-e PIP_NO_CACHE_DIR=1 \
-e LDFLAGS="-Wl,-z,max-page-size=0x1000" \
python:${{ matrix.python-version }}-bullseye \
bash -c "
set -e
python --version
# Install pip packages without cache to reduce memory usage
python -m pip install --no-cache-dir --upgrade pip
python -m pip install --no-cache-dir -r build_requirements.txt
bash os_dependencies/linux_arm.sh
# Source Rust environment after installation
. \$HOME/.cargo/env
python build_wheels_from_file.py --requirements '${{ inputs.packages }}'
"

- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-linux-armv7legacy-${{ matrix.python-version }}
path: ./downloaded_wheels

# Repair wheels for dynamically linked libraries on all platforms
# https://github.com/espressif/idf-python-wheels/blob/main/README.md#universal-wheel-tag---linking-of-dynamic-libraries
repair-wheels:
if: ${{ always() }}
needs: [get-supported-versions, ubuntu-latest, windows-latest, macos-latest, macos-m1, linux-armv7, linux-arm64]
needs: [get-supported-versions, ubuntu-latest, windows-latest, macos-latest, macos-m1, linux-armv7, linux-arm64, linux-armv7-legacy]
name: Repair wheels
uses: ./.github/workflows/wheels-repair.yml

# Test that all wheels can be installed on all supported platforms
test-wheels:
if: ${{ always() }}
needs: [get-supported-versions, repair-wheels]
name: Test wheels installation
uses: ./.github/workflows/test-wheels-install.yml
with:
supported_python_versions: ${{ needs.get-supported-versions.outputs.supported_python }}

upload-python-wheels:
if: ${{ always() }}
needs: [repair-wheels]
needs: [test-wheels]
name: Upload Python wheels
uses: espressif/idf-python-wheels/.github/workflows/upload-python-wheels.yml@main
uses: ./.github/workflows/upload-python-wheels.yml
secrets: inherit
10 changes: 9 additions & 1 deletion .github/workflows/build-wheels-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,16 @@ jobs:
name: Repair wheels
uses: ./.github/workflows/wheels-repair.yml

# Test that all wheels can be installed on all supported platforms
test-wheels:
needs: [get-supported-versions, repair-wheels]
name: Test wheels installation
uses: ./.github/workflows/test-wheels-install.yml
with:
supported_python_versions: ${{ needs.get-supported-versions.outputs.supported_python }}

upload-python-wheels:
needs: [repair-wheels]
needs: [test-wheels]
name: Upload Python wheels
uses: ./.github/workflows/upload-python-wheels.yml
secrets: inherit
111 changes: 111 additions & 0 deletions .github/workflows/test-wheels-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Test wheels installation

# Test that all built wheels are valid and platform-compatible
# This workflow runs after repair-wheels and before upload to catch any issues
# Uses test_wheels_install.py for consistent testing across all platforms

on:
workflow_call:
inputs:
supported_python_versions:
description: 'JSON array of supported Python versions'
required: true
type: string

jobs:
test-install:
name: Test ${{ matrix.os }} - Python ${{ matrix.python-version }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
os:
- Windows
- Linux x86_64
- macOS Intel
- macOS ARM
- Linux ARM64
- Linux ARMv7
- Linux ARMv7 Legacy
include:
- os: Windows
runner: windows-latest
arch: windows-x86_64
- os: Linux x86_64
runner: ubuntu-latest
arch: linux-x86_64
- os: macOS Intel
runner: macos-15-intel
arch: macos-x86_64
- os: macOS ARM
runner: macos-latest
arch: macos-arm64
- os: Linux ARM64
runner: ubuntu-24.04-arm
arch: linux-arm64
- os: Linux ARMv7
runner: ubuntu-latest
arch: linux-armv7
- os: Linux ARMv7 Legacy
runner: ubuntu-latest
arch: linux-armv7legacy
python-version: ${{ fromJson(inputs.supported_python_versions) }}
exclude:
# Python 3.14 doesn't have bullseye images for ARM
- python-version: '3.14'
os: Linux ARMv7 Legacy

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU for ARMv7
if: matrix.os == 'Linux ARMv7' || matrix.os == 'Linux ARMv7 Legacy'
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm/v7

- name: Download repaired wheels
uses: actions/download-artifact@v4
with:
name: wheels-repaired-${{ matrix.arch }}
path: ./downloaded_wheels

- name: Setup Python
if: matrix.os != 'Linux ARMv7' && matrix.os != 'Linux ARMv7 Legacy'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Test wheel installation
if: matrix.os != 'Linux ARMv7' && matrix.os != 'Linux ARMv7 Legacy'
run: |
python --version
python -m pip install --upgrade pip
python test/test_wheels_install.py

- name: Test wheel installation - ARMv7 (in Docker)
if: matrix.os == 'Linux ARMv7'
run: |
docker run --rm --platform linux/arm/v7 \
-v $(pwd):/work \
-w /work \
python:${{ matrix.python-version }}-bookworm \
bash -c "
python --version
python -m pip install --upgrade pip
python test/test_wheels_install.py
"

- name: Test wheel installation - ARMv7 Legacy (in Docker)
if: matrix.os == 'Linux ARMv7 Legacy'
run: |
docker run --rm --platform linux/arm/v7 \
-v $(pwd):/work \
-w /work \
python:${{ matrix.python-version }}-bullseye \
bash -c "
python --version
python -m pip install --upgrade pip
python test/test_wheels_install.py
"
38 changes: 38 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Unit Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
get-supported-versions:
name: Get Supported Versions
uses: ./.github/workflows/get-supported-versions.yml
secrets: inherit

unit-tests:
name: Unit Tests (Python ${{ matrix.python-version }})
needs: get-supported-versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install packaging pyyaml colorama requests

- name: Run unit tests
run: python -m unittest discover -s test -v
32 changes: 23 additions & 9 deletions .github/workflows/wheels-repair.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,37 +82,50 @@ jobs:
path: ./downloaded_wheels
merge-multiple: true

- name: Check for wheels
id: check-wheels
run: |
if [ -d "./downloaded_wheels" ] && [ -n "$(find ./downloaded_wheels -name '*.whl' 2>/dev/null)" ]; then
echo "has_wheels=true" >> $GITHUB_OUTPUT
echo "Found wheels to repair"
else
echo "has_wheels=false" >> $GITHUB_OUTPUT
echo "No wheels found for ${{ matrix.platform }} - skipping repair"
fi
shell: bash

- name: Setup Python
if: steps.check-wheels.outputs.has_wheels == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Set up QEMU
if: matrix.setup_qemu
if: matrix.setup_qemu && steps.check-wheels.outputs.has_wheels == 'true'
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.qemu_platform }}

- name: Install repair tool - Windows
if: matrix.tool == 'delvewheel'
if: matrix.tool == 'delvewheel' && steps.check-wheels.outputs.has_wheels == 'true'
run: python -m pip install delvewheel

- name: Install repair tool - macOS
if: matrix.tool == 'delocate'
if: matrix.tool == 'delocate' && steps.check-wheels.outputs.has_wheels == 'true'
run: python -m pip install delocate

- name: Install OS dependencies - macOS
if: matrix.tool == 'delocate'
if: matrix.tool == 'delocate' && steps.check-wheels.outputs.has_wheels == 'true'
run: bash os_dependencies/macos.sh

- name: Install dependencies and repair - Windows/macOS
if: matrix.tool != 'auditwheel'
if: matrix.tool != 'auditwheel' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
python -m pip install -r build_requirements.txt
python repair_wheels.py

- name: Repair Linux x86_64 wheels in manylinux container
if: matrix.platform == 'Linux x86_64'
if: matrix.platform == 'Linux x86_64' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
-v $(pwd):/work \
Expand All @@ -127,7 +140,7 @@ jobs:
"

- name: Repair Linux ARM64 wheels in manylinux container
if: matrix.platform == 'Linux ARM64'
if: matrix.platform == 'Linux ARM64' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
--platform ${{ matrix.docker_platform }} \
Expand All @@ -144,7 +157,7 @@ jobs:

- name: Repair Linux ARMv7 wheels in manylinux container
# Using --break-system-packages and --ignore-installed to avoid conflicts with system packages
if: matrix.platform == 'Linux ARMv7'
if: matrix.platform == 'Linux ARMv7' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
--platform ${{ matrix.docker_platform }} \
Expand All @@ -160,7 +173,7 @@ jobs:

- name: Repair Linux ARMv7 Legacy wheels in manylinux container
# Using --break-system-packages and --ignore-installed to avoid conflicts with system packages
if: matrix.platform == 'Linux ARMv7 Legacy'
if: matrix.platform == 'Linux ARMv7 Legacy' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
--platform ${{ matrix.docker_platform }} \
Expand All @@ -175,6 +188,7 @@ jobs:
"

- name: Re-upload artifacts with repaired wheels
if: steps.check-wheels.outputs.has_wheels == 'true'
uses: actions/upload-artifact@v4
with:
name: wheels-repaired-${{ matrix.arch }}
Expand Down
Loading