1616 triage :
1717 name : ${{ matrix.os }} - ${{ matrix.python-version }}
1818 runs-on : ${{ matrix.runner }}
19+ env :
20+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1921 strategy :
2022 fail-fast : false
2123 matrix :
@@ -29,16 +31,22 @@ jobs:
2931 include :
3032 - os : Windows
3133 runner : windows-latest
34+ arch : windows-x86_64
3235 - os : Linux x86_64
3336 runner : ubuntu-latest
37+ arch : linux-x86_64
3438 - os : macOS Intel
3539 runner : macos-15-intel
40+ arch : macos-x86_64
3641 - os : macOS ARM
3742 runner : macos-latest
43+ arch : macos-arm64
3844 - os : Linux ARM64
3945 runner : ubuntu-24.04-arm
46+ arch : linux-arm64
4047 - os : Linux ARMv7
41- runner : linux-armv7-self-hosted # Self-hosted ARMv7 runner
48+ runner : ubuntu-latest
49+ arch : linux-armv7
4250 python-version : ${{ fromJson(inputs.supported_python_versions) }}
4351 exclude :
4452 # Exclude oldest supported Python since it's already built in the platform builds
@@ -55,28 +63,31 @@ jobs:
5563 - python-version : ${{ inputs.oldest_supported_python }}
5664 os : Linux ARMv7
5765
58- # Use python container on ARM - dynamically constructed with bookworm (Debian 12)
59- container : ${{matrix.os == 'Linux ARMv7' && format('python:{0}-bookworm', matrix.python-version) || null}}
60-
6166 steps :
67+ - name : Set up QEMU for ARMv7
68+ if : matrix.os == 'Linux ARMv7'
69+ uses : docker/setup-qemu-action@v3
70+ with :
71+ platforms : linux/arm/v7
72+
6273 - name : Checkout repository
6374 uses : actions/checkout@v4
6475
6576 - name : Setup Python
66- # Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
77+ # Skip setting python on ARMv7 (runs in Docker)
6778 if : matrix.os != 'Linux ARMv7'
6879 uses : actions/setup-python@v5
6980 with :
7081 python-version : ${{ matrix.python-version }}
7182
72-
7383 - name : Get Python version
84+ if : matrix.os != 'Linux ARMv7'
7485 run : |
7586 python --version
7687 python -m pip install --upgrade pip
7788
78-
7989 - name : Install dependencies
90+ if : matrix.os != 'Linux ARMv7'
8091 run : python -m pip install -r build_requirements.txt
8192
8293 - name : Install additional OS dependencies - Ubuntu
@@ -87,52 +98,67 @@ jobs:
8798 if : matrix.os == 'macOS ARM' || matrix.os == 'macOS Intel'
8899 run : os_dependencies/macos.sh
89100
90-
91- - name : Install additional OS dependencies - Linux ARM7
92- if : matrix.os == 'Linux ARMv7' || matrix.os == 'Linux ARM64'
101+ - name : Install additional OS dependencies - Linux ARM64
102+ if : matrix.os == 'Linux ARM64'
93103 run : os_dependencies/linux_arm.sh
94104
95105 - name : Download artifacts
96106 uses : actions/download-artifact@v4
97107 with :
98- name : dependent_requirements_${{ matrix.runner }}
99- path : dependent_requirements_${{ matrix.runner }}
108+ name : dependent_requirements_${{ matrix.arch }}
109+ path : dependent_requirements_${{ matrix.arch }}
100110
101111 - name : Print requirements
102112 if : matrix.os != 'Windows'
103- run : cat dependent_requirements_${{ matrix.runner }}/dependent_requirements.txt
113+ run : cat dependent_requirements_${{ matrix.arch }}/dependent_requirements.txt
104114
105115 - name : Print requirements - Windows
106116 if : matrix.os == 'Windows'
107- run : type dependent_requirements_${{ matrix.runner }}\\dependent_requirements.txt
117+ run : type dependent_requirements_${{ matrix.arch }}\\dependent_requirements.txt
108118
109- - name : Build Python dependent wheels for ${{ matrix.python-version }}
110- if : matrix.os != 'Windows'
119+ - name : Build Python dependent wheels - ARMv7 (in Docker)
120+ if : matrix.os == 'Linux ARMv7'
121+ run : |
122+ docker run --rm --platform linux/arm/v7 \
123+ -v $(pwd):/work \
124+ -w /work \
125+ -e PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 \
126+ -e GH_TOKEN="${GH_TOKEN}" \
127+ -e PIP_NO_CACHE_DIR=1 \
128+ python:${{ matrix.python-version }}-bookworm \
129+ bash -c "
130+ set -e
131+ python --version
132+ # Install pip packages without cache to reduce memory usage
133+ python -m pip install --no-cache-dir --upgrade pip
134+ python -m pip install --no-cache-dir -r build_requirements.txt
135+ bash os_dependencies/linux_arm.sh
136+ # Source Rust environment after installation
137+ . \$HOME/.cargo/env
138+ python build_wheels_from_file.py dependent_requirements_${{ matrix.arch }}
139+ "
140+
141+ - name : Build Python dependent wheels - Linux/macOS
142+ if : matrix.os != 'Windows' && matrix.os != 'Linux ARMv7'
111143 run : |
112- # Source Rust environment for ARMv7
113- if [ "${{ matrix.os }}" = "Linux ARMv7" ]; then
114- export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
115- . $HOME/.cargo/env
116- fi
117-
118144 # Set ARCHFLAGS for macOS to prevent universal2 wheels
119145 if [ "${{ matrix.os }}" = "macOS ARM" ]; then
120146 export ARCHFLAGS="-arch arm64"
121147 elif [ "${{ matrix.os }}" = "macOS Intel" ]; then
122148 export ARCHFLAGS="-arch x86_64"
123149 fi
124150
125- python build_wheels_from_file.py dependent_requirements_${{ matrix.runner }}
151+ python build_wheels_from_file.py dependent_requirements_${{ matrix.arch }}
126152
127153 - name : Build Python dependent wheels for ${{ matrix.python-version }} - Windows
128154 if : matrix.os == 'Windows'
129- run : python build_wheels_from_file.py dependent_requirements_${{ matrix.runner }}
155+ run : python build_wheels_from_file.py dependent_requirements_${{ matrix.arch }}
130156
131157
132158 - name : Upload artifacts
133159 uses : actions/upload-artifact@v4
134160 with :
135- name : wheels-download-directory-${{ matrix.runner }}-${{ matrix.python-version }}
161+ name : wheels-download-directory-${{ matrix.arch }}-${{ matrix.python-version }}
136162 if-no-files-found : ignore
137163 path : ./downloaded_wheels
138164 retention-days : 1
0 commit comments