|
73 | 73 | "(test_kind or test_multiarray or test_simd or test_umath or test_ufunc) and not test_gcd_overflow", |
74 | 74 | "s390x" |
75 | 75 | ] |
76 | | - - [ |
77 | | - "riscv64", |
78 | | - "riscv64-linux-gnu", |
79 | | - "riscv64/ubuntu:22.04", |
80 | | - "-Dallow-noblas=true", |
81 | | - "test_kind or test_multiarray or test_simd or test_umath or test_ufunc", |
82 | | - "riscv64" |
83 | | - ] |
84 | 76 | env: |
85 | 77 | TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }} |
86 | 78 | DOCKER_CONTAINER: ${{ matrix.BUILD_PROP[2] }} |
@@ -170,7 +162,7 @@ jobs: |
170 | 162 | '" |
171 | 163 |
|
172 | 164 |
|
173 | | - linux_loongarch64_qemu: |
| 165 | + linux_loongarch64_riscv64_qemu: |
174 | 166 | # Only workflow_dispatch is enabled on forks. |
175 | 167 | # To enable this job and subsequent jobs on a fork for other events, comment out: |
176 | 168 | if: github.repository == 'numpy/numpy' || github.event_name == 'workflow_dispatch' |
@@ -267,3 +259,108 @@ jobs: |
267 | 259 | /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c ' |
268 | 260 | cd /numpy && spin test -- -k \"${RUNTIME_TEST_FILTER}\" |
269 | 261 | '" |
| 262 | +
|
| 263 | +
|
| 264 | + linux_riscv64_qemu: |
| 265 | + # To enable this workflow on a fork, comment out: |
| 266 | + if: github.repository == 'numpy/numpy' |
| 267 | + runs-on: ubuntu-24.04 |
| 268 | + continue-on-error: true |
| 269 | + strategy: |
| 270 | + fail-fast: false |
| 271 | + matrix: |
| 272 | + BUILD_PROP: |
| 273 | + - [ |
| 274 | + "riscv64", |
| 275 | + "riscv64-linux-gnu", |
| 276 | + "riscv64/ubuntu:24.04", |
| 277 | + "-Dallow-noblas=true", |
| 278 | + "test_kind or test_multiarray or test_simd or test_umath or test_ufunc", |
| 279 | + "riscv64" |
| 280 | + ] |
| 281 | + env: |
| 282 | + TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }} |
| 283 | + DOCKER_CONTAINER: ${{ matrix.BUILD_PROP[2] }} |
| 284 | + MESON_OPTIONS: ${{ matrix.BUILD_PROP[3] }} |
| 285 | + RUNTIME_TEST_FILTER: ${{ matrix.BUILD_PROP[4] }} |
| 286 | + ARCH: ${{ matrix.BUILD_PROP[5] }} |
| 287 | + TERM: xterm-256color |
| 288 | + |
| 289 | + name: "${{ matrix.BUILD_PROP[0] }}" |
| 290 | + steps: |
| 291 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 292 | + with: |
| 293 | + submodules: recursive |
| 294 | + fetch-tags: true |
| 295 | + persist-credentials: false |
| 296 | + |
| 297 | + - name: Initialize binfmt_misc for qemu-user-static |
| 298 | + run: | |
| 299 | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 300 | +
|
| 301 | + - name: Install GCC cross-compilers |
| 302 | + run: | |
| 303 | + sudo apt update |
| 304 | + sudo apt install -y ninja-build gcc-14-${TOOLCHAIN_NAME} g++-14-${TOOLCHAIN_NAME} gfortran-14-${TOOLCHAIN_NAME} |
| 305 | +
|
| 306 | + - name: Cache docker container |
| 307 | + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
| 308 | + id: container-cache |
| 309 | + with: |
| 310 | + path: ~/docker_${{ matrix.BUILD_PROP[1] }} |
| 311 | + key: container-${{ runner.os }}-${{ matrix.BUILD_PROP[1] }}-${{ matrix.BUILD_PROP[2] }}-${{ hashFiles('requirements/build_requirements.txt') }} |
| 312 | + |
| 313 | + - name: Creates new container |
| 314 | + if: steps.container-cache.outputs.cache-hit != 'true' |
| 315 | + run: | |
| 316 | + docker run --platform=linux/${ARCH} --name the_container --interactive \ |
| 317 | + -v /:/host -v $(pwd):/numpy ${DOCKER_CONTAINER} /bin/bash -c " |
| 318 | + apt update && |
| 319 | + apt install -y cmake git python3 python-is-python3 python3-dev python3-pip && |
| 320 | + mkdir -p /lib64 && ln -s /host/lib64/ld-* /lib64/ && |
| 321 | + ln -s /host/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu && |
| 322 | + rm -rf /usr/${TOOLCHAIN_NAME} && ln -s /host/usr/${TOOLCHAIN_NAME} /usr/${TOOLCHAIN_NAME} && |
| 323 | + rm -rf /usr/lib/gcc/${TOOLCHAIN_NAME} && ln -s /host/usr/lib/gcc-cross/${TOOLCHAIN_NAME} /usr/lib/gcc/${TOOLCHAIN_NAME} && |
| 324 | + rm -f /usr/bin/gcc && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-gcc-14 /usr/bin/gcc && |
| 325 | + rm -f /usr/bin/g++ && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-g++-14 /usr/bin/g++ && |
| 326 | + rm -f /usr/bin/gfortran && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-gfortran-14 /usr/bin/gfortran && |
| 327 | + rm -f /usr/bin/ar && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-ar /usr/bin/ar && |
| 328 | + rm -f /usr/bin/as && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-as /usr/bin/as && |
| 329 | + rm -f /usr/bin/ld && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-ld /usr/bin/ld && |
| 330 | + rm -f /usr/bin/ld.bfd && ln -s /host/usr/bin/${TOOLCHAIN_NAME}-ld.bfd /usr/bin/ld.bfd && |
| 331 | + rm -f /usr/bin/ninja && ln -s /host/usr/bin/ninja /usr/bin/ninja && |
| 332 | + git config --global --add safe.directory /numpy && |
| 333 | + # No need to build ninja from source, the host ninja is used for the build |
| 334 | + grep -v ninja /numpy/requirements/build_requirements.txt > /tmp/build_requirements.txt && |
| 335 | + python -m pip install --break-system-packages -r /tmp/build_requirements.txt && |
| 336 | + python -m pip install --break-system-packages pytest pytest-xdist hypothesis typing_extensions pytest-timeout && |
| 337 | + rm -f /usr/local/bin/ninja && mkdir -p /usr/local/bin && ln -s /host/usr/bin/ninja /usr/local/bin/ninja |
| 338 | + " |
| 339 | + docker commit the_container the_container |
| 340 | + mkdir -p "~/docker_${TOOLCHAIN_NAME}" |
| 341 | + docker save -o "~/docker_${TOOLCHAIN_NAME}/the_container.tar" the_container |
| 342 | +
|
| 343 | + - name: Load container from cache |
| 344 | + if: steps.container-cache.outputs.cache-hit == 'true' |
| 345 | + run: docker load -i "~/docker_${TOOLCHAIN_NAME}/the_container.tar" |
| 346 | + |
| 347 | + - name: Meson Build |
| 348 | + run: | |
| 349 | + docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \ |
| 350 | + -v $(pwd):/numpy -v /:/host the_container \ |
| 351 | + /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c ' |
| 352 | + cd /numpy && spin build --clean -- ${MESON_OPTIONS} |
| 353 | + '" |
| 354 | +
|
| 355 | + - name: Meson Log |
| 356 | + if: always() |
| 357 | + run: 'cat build/meson-logs/meson-log.txt' |
| 358 | + |
| 359 | + - name: Run Tests |
| 360 | + run: | |
| 361 | + docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \ |
| 362 | + -v $(pwd):/numpy -v /:/host the_container \ |
| 363 | + /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c ' |
| 364 | + export F90=/usr/bin/gfortran |
| 365 | + cd /numpy && spin test -- --timeout=600 --durations=10 -k \"${RUNTIME_TEST_FILTER}\" |
| 366 | + '" |
0 commit comments