@@ -178,3 +178,85 @@ jobs:
178
178
'"
179
179
180
180
181
+ linux_loongarch64_qemu :
182
+ # To enable this workflow on a fork, comment out:
183
+ if : github.repository == 'numpy/numpy'
184
+ runs-on : ubuntu-24.04
185
+ continue-on-error : true
186
+ strategy :
187
+ fail-fast : false
188
+ matrix :
189
+ BUILD_PROP :
190
+ - [
191
+ " loongarch64" ,
192
+ " loongarch64-linux-gnu" ,
193
+ " loongcr.lcpu.dev/lcpu/debian:unstable-240513" ,
194
+ " -Dallow-noblas=true" ,
195
+ " test_kind or test_multiarray or test_simd or test_umath or test_ufunc" ,
196
+ " loong64"
197
+ ]
198
+ env :
199
+ TOOLCHAIN_NAME : ${{ matrix.BUILD_PROP[1] }}
200
+ DOCKER_CONTAINER : ${{ matrix.BUILD_PROP[2] }}
201
+ MESON_OPTIONS : ${{ matrix.BUILD_PROP[3] }}
202
+ RUNTIME_TEST_FILTER : ${{ matrix.BUILD_PROP[4] }}
203
+ ARCH : ${{ matrix.BUILD_PROP[5] }}
204
+ TERM : xterm-256color
205
+
206
+ name : " ${{ matrix.BUILD_PROP[0] }}"
207
+ steps :
208
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
209
+ with :
210
+ submodules : recursive
211
+ fetch-tags : true
212
+
213
+ - name : Initialize binfmt_misc for qemu-user-static
214
+ run : |
215
+ docker run --rm --privileged loongcr.lcpu.dev/multiarch/archlinux --reset -p yes
216
+
217
+ - name : Cache docker container
218
+ uses : actions/cache@v4.1.2
219
+ id : container-cache
220
+ with :
221
+ path : ~/docker_${{ matrix.BUILD_PROP[1] }}
222
+ key : container-${{ runner.os }}-${{ matrix.BUILD_PROP[1] }}-${{ matrix.BUILD_PROP[2] }}-${{ hashFiles('requirements/build_requirements.txt') }}
223
+
224
+ - name : Creates new container
225
+ if : steps.container-cache.outputs.cache-hit != 'true'
226
+ run : |
227
+ docker run --platform=linux/${ARCH} --name the_container --interactive \
228
+ -v /:/host -v $(pwd):/numpy ${DOCKER_CONTAINER} /bin/bash -c "
229
+ sed -i 's|URIs: http://mirrors.cloud.tencent.com/debian-ports|URIs: https://deb.debian.org/debian-ports|' /etc/apt/sources.list.d/debian.sources &&
230
+ apt update &&
231
+ apt install -y cmake cmake-data git python3 python-is-python3 python3-dev python3-pip gfortran &&
232
+ git config --global --add safe.directory /numpy &&
233
+ python -m pip install --break-system-packages -r /numpy/requirements/build_requirements.txt &&
234
+ python -m pip install --break-system-packages pytest pytest-xdist hypothesis typing_extensions
235
+ "
236
+ docker commit the_container the_container
237
+ mkdir -p "~/docker_${TOOLCHAIN_NAME}"
238
+ docker save -o "~/docker_${TOOLCHAIN_NAME}/the_container.tar" the_container
239
+
240
+ - name : Load container from cache
241
+ if : steps.container-cache.outputs.cache-hit == 'true'
242
+ run : docker load -i "~/docker_${TOOLCHAIN_NAME}/the_container.tar"
243
+
244
+ - name : Meson Build
245
+ run : |
246
+ docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \
247
+ -v $(pwd):/numpy -v /:/host the_container \
248
+ /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c '
249
+ && cd /numpy/ && spin build --clean -- ${MESON_OPTIONS}
250
+ '"
251
+
252
+ - name : Meson Log
253
+ if : always()
254
+ run : ' cat build/meson-logs/meson-log.txt'
255
+
256
+ - name : Run Tests
257
+ run : |
258
+ docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \
259
+ -v $(pwd):/numpy -v /:/host the_container \
260
+ /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c '
261
+ cd /numpy && spin test -- -k \"${RUNTIME_TEST_FILTER}\"
262
+ '"
0 commit comments