@@ -17,33 +17,52 @@ jobs:
1717 build-wheels :
1818 needs : get-supported-versions
1919 name : Build for ${{ matrix.os }} (Python ${{matrix.python-version}})
20- runs-on : ${{ matrix.os }}
20+ runs-on : ${{ matrix.runner }}
2121 strategy :
2222 fail-fast : false
2323 matrix :
24- os : # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners- for-public-repositories
25- - windows-latest
26- - ubuntu-latest
27- - macos-15-intel # MacOS x86_64
28- - macos-latest # MacOS arm64 (M1)
29- - ubuntu-24.04-arm
30- - linux-armv7-self-hosted
24+ os : # Platform names for identification
25+ - Windows
26+ - Linux x86_64
27+ - macOS Intel
28+ - macOS ARM
29+ - Linux ARM64
30+ - Linux ARMv7
3131 include :
32- - os : linux-armv7-self-hosted
33- CONTAINER : python:${{ needs.get-supported-versions.outputs.oldest_supported_python }}-bookworm
32+ - os : Windows
33+ runner : windows-latest
34+ arch : windows-x86_64
35+ - os : Linux x86_64
36+ runner : ubuntu-latest
37+ arch : linux-x86_64
38+ - os : macOS Intel
39+ runner : macos-15-intel
40+ arch : macos-x86_64
41+ - os : macOS ARM
42+ runner : macos-latest
43+ arch : macos-arm64
44+ - os : Linux ARM64
45+ runner : ubuntu-24.04-arm
46+ arch : linux-arm64
47+ - os : Linux ARMv7
48+ runner : ubuntu-latest
49+ arch : linux-armv7
3450 python-version : ['${{ needs.get-supported-versions.outputs.oldest_supported_python }}']
3551
36- # Use python container on ARM
37- container : ${{ matrix.CONTAINER }}
38-
3952 steps :
53+ - name : Set up QEMU for ARMv7
54+ if : matrix.os == 'Linux ARMv7'
55+ uses : docker/setup-qemu-action@v3
56+ with :
57+ platforms : linux/arm/v7
58+
4059 - name : OS info
41- if : matrix.os != 'windows-latest '
60+ if : matrix.os != 'Windows '
4261 run : |
4362 echo "Operating System: ${{ runner.os }}"
4463 echo "Architecture: $(uname -m)"
4564 - name : OS info
46- if : matrix.os == 'windows-latest '
65+ if : matrix.os == 'Windows '
4766 run : |
4867 echo "Operating System: ${{ runner.os }}"
4968 echo "Architecture: $env:PROCESSOR_ARCHITECTURE"
@@ -60,66 +79,92 @@ jobs:
6079
6180 - name : Setup Python
6281 # Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
63- if : matrix.os != 'linux-armv7-self-hosted '
82+ if : matrix.os != 'Linux ARMv7 '
6483 uses : actions/setup-python@v5
6584 with :
6685 python-version : ${{ matrix.python-version }}
6786
6887
6988 - name : Install build dependencies
89+ if : matrix.os != 'Linux ARMv7'
7090 run : |
7191 python -m pip install --upgrade pip
7292 python -m pip install -r build_requirements.txt
7393
74-
7594 - name : Get Tools versions
95+ if : matrix.os != 'Linux ARMv7'
7696 run : |
7797 python --version
7898 pip show pip setuptools
7999
80-
81100 - name : Install additional OS dependencies - Ubuntu
82- if : matrix.os == 'ubuntu-latest '
101+ if : matrix.os == 'Linux x86_64 '
83102 run : os_dependencies/ubuntu.sh
84103
85104 - name : Install additional OS dependencies - MacOS
86- if : matrix.os == 'macos-latest ' || matrix.os == 'macos-15-intel '
105+ if : matrix.os == 'macOS ARM ' || matrix.os == 'macOS Intel '
87106 run : os_dependencies/macos.sh
88107
89- - name : Install additional OS dependencies - Linux ARM
90- if : matrix.os == 'linux-armv7-self-hosted' || matrix.os == 'ubuntu-24.04-arm '
108+ - name : Install additional OS dependencies - Linux ARM64
109+ if : matrix.os == 'Linux ARM64 '
91110 run : os_dependencies/linux_arm.sh
92111
93112 - name : Install additional OS dependencies - Windows
94- if : matrix.os == 'windows-latest '
113+ if : matrix.os == 'Windows '
95114 run : powershell -ExecutionPolicy Bypass -File os_dependencies/windows.ps1
96115
97-
98- - name : Build wheels for IDF
99- if : matrix.os != 'windows-latest'
116+ - name : Build wheels for IDF - ARMv7 (in Docker)
117+ if : matrix.os == 'Linux ARMv7'
100118 run : |
101- # Source Rust environment for self-hosted ARMv7 runner
102- if [ "${{ matrix.os }}" = "linux-armv7-self-hosted" ]; then
103- . $HOME/.cargo/env
119+ docker run --rm --platform linux/arm/v7 \
120+ -v $(pwd):/work \
121+ -w /work \
122+ -e MIN_IDF_MAJOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_major_version }} \
123+ -e MIN_IDF_MINOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_minor_version }} \
124+ -e GH_TOKEN="${GH_TOKEN}" \
125+ -e PIP_NO_CACHE_DIR=1 \
126+ python:${{ matrix.python-version }}-bookworm \
127+ bash -c "
128+ set -e
129+ python --version
130+ # Install pip packages without cache to reduce memory usage
131+ python -m pip install --no-cache-dir --upgrade pip
132+ python -m pip install --no-cache-dir -r build_requirements.txt
133+ bash os_dependencies/linux_arm.sh
134+ # Source Rust environment after installation
135+ . \$HOME/.cargo/env
136+ python build_wheels.py
137+ "
138+
139+ - name : Build wheels for IDF - Linux/macOS
140+ if : matrix.os != 'Windows' && matrix.os != 'Linux ARMv7'
141+ run : |
142+ # Set ARCHFLAGS for macOS to prevent universal2 wheels
143+ if [ "${{ matrix.os }}" = "macOS ARM" ]; then
144+ export ARCHFLAGS="-arch arm64"
145+ elif [ "${{ matrix.os }}" = "macOS Intel" ]; then
146+ export ARCHFLAGS="-arch x86_64"
104147 fi
105148
106149 python build_wheels.py
107150
108151 - name : Build wheels for IDF - Windows
109- if : matrix.os == 'windows-latest '
152+ if : matrix.os == 'Windows '
110153 run : python build_wheels.py
111154
112155 - name : Upload artifacts of downloaded_wheels directory
113156 uses : actions/upload-artifact@v4
114157 with :
115- name : wheels-download-directory-${{ matrix.os }}-${{ matrix.python-version }}
158+ name : wheels-download-directory-${{ matrix.arch }}-${{ matrix.python-version }}
116159 path : ./downloaded_wheels
160+ retention-days : 1
117161
118162 - name : Upload artifacts of Python version dependent wheels
119163 uses : actions/upload-artifact@v4
120164 with :
121- name : dependent_requirements_${{ matrix.os }}
165+ name : dependent_requirements_${{ matrix.arch }}
122166 path : ./dependent_requirements.txt
167+ retention-days : 1
123168
124169
125170 build-python-version-dependent-wheels :
@@ -130,9 +175,15 @@ jobs:
130175 supported_python_versions : ${{ needs.get-supported-versions.outputs.supported_python }}
131176 oldest_supported_python : ${{ needs.get-supported-versions.outputs.oldest_supported_python }}
132177
133- # TODO Uncomment this when we are ready to upload the wheels
134- # upload-python-wheels:
135- # needs: [build-wheels, build-python-version-dependent-wheels]
136- # name: Upload Python wheels
137- # uses: ./.github/workflows/upload-python-wheels.yml
138- # secrets: inherit
178+ # Repair wheels for dynamically linked libraries on all platforms
179+ # https://github.com/espressif/idf-python-wheels/blob/main/README.md#universal-wheel-tag---linking-of-dynamic-libraries
180+ repair-wheels :
181+ needs : [build-wheels, build-python-version-dependent-wheels]
182+ name : Repair wheels
183+ uses : ./.github/workflows/wheels-repair.yml
184+
185+ upload-python-wheels :
186+ needs : [repair-wheels]
187+ name : Upload Python wheels
188+ uses : ./.github/workflows/upload-python-wheels.yml
189+ secrets : inherit
0 commit comments