@@ -19,6 +19,7 @@ concurrency:
19
19
20
20
env :
21
21
PYTHON_VERSION : ' 3.9'
22
+ PYTHON_VERSION_WIN_ARM64 : ' 3.11' # ARM64 Windows doesn't have older versions
22
23
CARGO_INCREMENTAL : 0
23
24
CARGO_NET_RETRY : 10
24
25
RUSTUP_MAX_RETRIES : 10
@@ -93,17 +94,75 @@ jobs:
93
94
fail-fast : false
94
95
matrix :
95
96
package : [polars, polars-lts-cpu, polars-u64-idx]
96
- os : [ubuntu-latest, macos-13, windows-latest]
97
+ os : [ubuntu-latest, macos-13, windows-latest, windows-arm64-16gb ]
97
98
architecture : [x86-64, aarch64]
98
99
exclude :
99
100
- os : windows-latest
100
101
architecture : aarch64
102
+ - os : windows-arm64-16gb
103
+ architecture : x86-64
101
104
102
105
env :
103
106
SED_INPLACE : ${{ matrix.os == 'macos-13' && '-i ''''' || '-i'}}
104
107
CPU_CHECK_MODULE : py-polars/polars/_cpu_check.py
105
108
106
109
steps :
110
+ - name : Setup build environment (ARM64 Windows)
111
+ if : matrix.os == 'windows-arm64-16gb'
112
+ shell :
113
+ powershell
114
+ # Notes
115
+ # * We update `Expand-Archive` to avoid "" is not a supported archive file format when extracting
116
+ # files that don't end in `.zip`
117
+ run : |
118
+ Write-Output "> Update Expand-Archive (Microsoft.PowerShell.Archive)"
119
+ Install-PackageProvider -Name NuGet -Force
120
+ Install-Module -Name Microsoft.PowerShell.Archive -Force
121
+
122
+ Write-Output "> Setup bash.exe (git-for-windows/PortableGit)"
123
+ Invoke-WebRequest "https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.1/PortableGit-2.47.1-arm64.7z.exe" -OutFile /git.7z.exe
124
+ /git.7z.exe -o/git -y
125
+
126
+ Write-Output "> Setup Rust"
127
+ Invoke-WebRequest "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe" -OutFile /rustup-init.exe
128
+ /rustup-init.exe --default-host aarch64-pc-windows-msvc -y
129
+
130
+ Write-Output "> Setup VS Build Tools"
131
+ Invoke-WebRequest "https://aka.ms/vs/17/release/vs_BuildTools.exe" -OutFile /vs_BuildTools.exe
132
+ Start-Process C:/vs_BuildTools.exe -ArgumentList " `
133
+ --add Microsoft.VisualStudio.Workload.NativeDesktop `
134
+ --add Microsoft.VisualStudio.Workload.VCTools `
135
+ --add Microsoft.VisualStudio.Component.VC.Tools.arm64 `
136
+ --add Microsoft.VisualStudio.Component.VC.Llvm.Clang `
137
+ --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset `
138
+ --includeRecommended --quiet --norestart --wait" -Wait
139
+
140
+ Write-Output "> Setup CMake"
141
+ Invoke-WebRequest "https://github.com/Kitware/CMake/releases/download/v3.31.2/cmake-3.31.2-windows-arm64.zip" -OutFile /cmake.zip
142
+ Expand-Archive /cmake.zip -DestinationPath /
143
+
144
+ Write-Output "> Download jq.exe (github.com/jqlang) (needed for tomlq / yq)"
145
+ Invoke-WebRequest https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-i386.exe -OutFile /jq.exe
146
+
147
+ Write-Output "> Update GITHUB_PATH"
148
+ [System.IO.File]::AppendAllText($Env:GITHUB_PATH, "`n" + "C:/git/bin/")
149
+ [System.IO.File]::AppendAllText($Env:GITHUB_PATH, "`n" + $Env:USERPROFILE + "/.cargo/bin/")
150
+ [System.IO.File]::AppendAllText($Env:GITHUB_PATH, "`n" + "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/Llvm/bin/")
151
+ [System.IO.File]::AppendAllText($Env:GITHUB_PATH, "`n" + "C:/cmake-3.31.2-windows-arm64/bin")
152
+ [System.IO.File]::AppendAllText($Env:GITHUB_PATH, "`n" + "C:/")
153
+ [System.IO.File]::AppendAllText($Env:GITHUB_PATH, "`n")
154
+
155
+ Get-Content $Env:GITHUB_PATH | Out-Host
156
+
157
+ - name : Check build environment (ARM64 Windows)
158
+ if : matrix.os == 'windows-arm64-16gb'
159
+ run : |
160
+ set -x
161
+ bash --version
162
+ rustup show
163
+ clang -v
164
+ cmake --version
165
+
107
166
- uses : actions/checkout@v4
108
167
with :
109
168
ref : ${{ inputs.sha }}
@@ -116,19 +175,35 @@ jobs:
116
175
swap-size-gb : 10
117
176
118
177
- name : Set up Python
178
+ if : matrix.os != 'windows-arm64-16gb'
119
179
uses : actions/setup-python@v5
120
180
with :
121
181
python-version : ${{ env.PYTHON_VERSION }}
122
182
183
+ - name : Set up Python (ARM64 Windows)
184
+ if : matrix.os == 'windows-arm64-16gb'
185
+ uses : actions/setup-python@v5
186
+ with :
187
+ python-version : ${{ env.PYTHON_VERSION_WIN_ARM64 }}
188
+
189
+ # Otherwise can't find `tomlq` after `pip install yq`
190
+ - name : Add Python scripts folder to GITHUB_PATH (ARM64 Windows)
191
+ if : matrix.os == 'windows-arm64-16gb'
192
+ run : |
193
+ python -c "import sysconfig; print(sysconfig.get_path('scripts'))" >> $GITHUB_PATH
194
+
123
195
- name : Install yq
124
196
if : matrix.package != 'polars'
125
197
run : pip install yq
198
+
126
199
- name : Update package name
127
200
if : matrix.package != 'polars'
128
201
run : tomlq -i -t ".project.name = \"${{ matrix.package }}\"" py-polars/pyproject.toml
202
+
129
203
- name : Add bigidx feature
130
204
if : matrix.package == 'polars-u64-idx'
131
205
run : tomlq -i -t '.dependencies.polars.features += ["bigidx"]' py-polars/Cargo.toml
206
+
132
207
- name : Update optional dependencies
133
208
if : matrix.package != 'polars'
134
209
run : sed $SED_INPLACE 's/polars\[/${{ matrix.package }}\[/' py-polars/pyproject.toml
@@ -181,14 +256,29 @@ jobs:
181
256
if : matrix.architecture == 'aarch64'
182
257
id : target
183
258
run : |
184
- TARGET=${{ matrix.os == 'macos-13' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu'}}
259
+ TARGET=$(
260
+ if [[ "${{ matrix.os }}" == "macos-13" ]]; then
261
+ echo "aarch64-apple-darwin";
262
+ elif [[ "${{ matrix.os }}" == "windows-arm64-16gb" ]]; then
263
+ echo "aarch64-pc-windows-msvc";
264
+ else
265
+ echo "aarch64-unknown-linux-gnu";
266
+ fi
267
+ )
185
268
echo "target=$TARGET" >> $GITHUB_OUTPUT
186
269
187
270
- name : Set jemalloc for aarch64 Linux
188
271
if : matrix.architecture == 'aarch64' && matrix.os == 'ubuntu-latest'
189
272
run : |
190
273
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
191
274
275
+ - name : Copy toolchain to py-polars/ (ARM64 Windows)
276
+ # Manual fix for:
277
+ # TomlError: Unknown character "46" at row 1, col 2, pos 1:
278
+ # 1> ../rust-toolchain.toml
279
+ if : matrix.os == 'windows-arm64-16gb'
280
+ run : cp rust-toolchain.toml py-polars/
281
+
192
282
- name : Build wheel
193
283
uses : PyO3/maturin-action@v1
194
284
with :
0 commit comments