1- # Cross-platform testing for quaddtype on high-endianness architectures using QEMU.
2- # This workflow uses Docker containers with QEMU emulation to test on different architectures,
3- # particularly focusing on big-endian systems where byte order matters for quad precision operations.
4- #
5- # The recommended practice is to rely on Docker to provide the cross-compile toolchain,
6- # enabling native execution via binfmt.
1+ # Cross-platform testing for quaddtype on big-endian architectures using QEMU.
2+ # This workflow focuses specifically on big-endian systems to test byte order handling
3+ # in quad precision operations, since little-endian systems are already covered by standard CI.
74
8- name : Linux QEMU Endianness Tests
5+ name : Big-Endian Architecture Tests
96
107on :
118 pull_request :
129 branches :
1310 - main
11+ - maintenance/**
1412 paths :
1513 - " quaddtype/**"
1614 - " .github/workflows/**"
@@ -28,25 +26,13 @@ permissions:
2826 contents : read
2927
3028jobs :
31- linux_qemu_endian :
29+ big_endian_tests :
3230 runs-on : ubuntu-22.04
3331 continue-on-error : true
3432 strategy :
3533 fail-fast : false
3634 matrix :
3735 BUILD_PROP :
38- - [
39- " ppc64le (Power9 Little Endian)" ,
40- " powerpc64le-linux-gnu" ,
41- " ppc64le/ubuntu:22.04" ,
42- " ppc64le"
43- ]
44- - [
45- " ppc64le - baseline(Power9)" ,
46- " powerpc64le-linux-gnu" ,
47- " ppc64le/ubuntu:22.04" ,
48- " ppc64le"
49- ]
5036 - [
5137 " s390x (IBM Z Big Endian)" ,
5238 " s390x-linux-gnu" ,
5945 " s390x/ubuntu:22.04" ,
6046 " s390x"
6147 ]
62- - [
63- " riscv64 (Little Endian)" ,
64- " riscv64-linux-gnu" ,
65- " riscv64/ubuntu:22.04" ,
66- " riscv64"
67- ]
6848 env :
6949 ARCH_NAME : ${{ matrix.BUILD_PROP[0] }}
7050 TOOLCHAIN_NAME : ${{ matrix.BUILD_PROP[1] }}
@@ -169,100 +149,6 @@ jobs:
169149 /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c '
170150 cd /workspace/quaddtype &&
171151 echo \"Running quaddtype tests on ${ARCH_NAME} (endianness: \$(python -c \"import sys; print(sys.byteorder)\"))\" &&
152+ echo \"Note: Testing big-endian byte order handling in quad precision operations\" &&
172153 pytest -vvv --color=yes --timeout=600 --tb=short tests/
173- '"
174-
175- linux_loongarch64_qemu :
176- runs-on : ubuntu-24.04
177- continue-on-error : true
178- strategy :
179- fail-fast : false
180- matrix :
181- BUILD_PROP :
182- - [
183- " loongarch64 (LoongArch Little Endian)" ,
184- " loongarch64-linux-gnu" ,
185- " cnclarechen/numpy-loong64-debian:v1" ,
186- " loong64"
187- ]
188- env :
189- ARCH_NAME : ${{ matrix.BUILD_PROP[0] }}
190- TOOLCHAIN_NAME : ${{ matrix.BUILD_PROP[1] }}
191- DOCKER_CONTAINER : ${{ matrix.BUILD_PROP[2] }}
192- ARCH : ${{ matrix.BUILD_PROP[3] }}
193- TERM : xterm-256color
194-
195- name : " ${{ matrix.BUILD_PROP[0] }}"
196- steps :
197- - uses : actions/checkout@v4
198- with :
199- submodules : recursive
200- fetch-tags : true
201-
202- - name : Initialize binfmt_misc for qemu-user-static (LoongArch)
203- run : |
204- docker run --rm --privileged loongcr.lcpu.dev/multiarch/archlinux --reset -p yes
205-
206- - name : Install GCC cross-compilers for LoongArch
207- run : |
208- sudo apt update
209- sudo apt install -y ninja-build gcc-14-${TOOLCHAIN_NAME} g++-14-${TOOLCHAIN_NAME} gfortran-14-${TOOLCHAIN_NAME}
210-
211- - name : Cache LoongArch docker container
212- uses : actions/cache@v4
213- id : container-cache
214- with :
215- path : ~/docker_${{ matrix.BUILD_PROP[1] }}
216- key : container-quaddtype-${{ runner.os }}-${{ matrix.BUILD_PROP[1] }}-${{ matrix.BUILD_PROP[2] }}-${{ hashFiles('quaddtype/pyproject.toml') }}
217-
218- - name : Create LoongArch cross-compilation container
219- if : steps.container-cache.outputs.cache-hit != 'true'
220- run : |
221- docker run --platform=linux/${ARCH} --name quaddtype_loong_container --interactive \
222- -v /:/host -v $(pwd):/workspace ${DOCKER_CONTAINER} /bin/bash -c "
223- # Set up cross-compilation environment for LoongArch
224- mkdir -p /lib64 && ln -sf /host/lib64/ld-* /lib64/ &&
225- ln -sf /host/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu &&
226- ln -sf /host/usr/${TOOLCHAIN_NAME} /usr/${TOOLCHAIN_NAME} &&
227- ln -sf /host/usr/lib/gcc-cross/${TOOLCHAIN_NAME} /usr/lib/gcc/${TOOLCHAIN_NAME} &&
228-
229- # Use GCC-14 for LoongArch
230- rm -f /usr/bin/gcc && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-gcc-14 /usr/bin/gcc &&
231- rm -f /usr/bin/g++ && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-g++-14 /usr/bin/g++ &&
232- rm -f /usr/bin/gfortran && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-gfortran-14 /usr/bin/gfortran &&
233- rm -f /usr/bin/ar && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-ar /usr/bin/ar &&
234- rm -f /usr/bin/as && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-as /usr/bin/as &&
235- rm -f /usr/bin/ld && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-ld /usr/bin/ld &&
236- rm -f /usr/bin/ld.bfd && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-ld.bfd /usr/bin/ld.bfd &&
237- rm -f /usr/bin/ninja && ln -sf /host/usr/bin/ninja /usr/bin/ninja &&
238-
239- git config --global --add safe.directory /workspace &&
240- python -m pip install --break-system-packages meson>=1.3.2 meson-python wheel numpy
241- "
242- docker commit quaddtype_loong_container quaddtype_loong_container
243- mkdir -p "~/docker_${TOOLCHAIN_NAME}"
244- docker save -o "~/docker_${TOOLCHAIN_NAME}/quaddtype_loong_container.tar" quaddtype_loong_container
245-
246- - name : Load LoongArch container from cache
247- if : steps.container-cache.outputs.cache-hit == 'true'
248- run : docker load -i "~/docker_${TOOLCHAIN_NAME}/quaddtype_loong_container.tar"
249-
250- - name : Build quaddtype on LoongArch
251- run : |
252- docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \
253- -v $(pwd):/workspace -v /:/host quaddtype_loong_container \
254- /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c '
255- cd /workspace/quaddtype &&
256- export LDFLAGS=\"-fopenmp\" &&
257- python -m pip install --break-system-packages .[test] -v --no-build-isolation --force-reinstall
258- '"
259-
260- - name : Run LoongArch tests
261- run : |
262- docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \
263- -v $(pwd):/workspace -v /:/host quaddtype_loong_container \
264- /bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c '
265- cd /workspace/quaddtype &&
266- echo \"Running quaddtype tests on ${ARCH_NAME} (endianness: \$(python -c \"import sys; print(sys.byteorder)\"))\" &&
267- pytest -vvv --color=yes tests/
268- '"
154+ '"
0 commit comments