Skip to content

Commit 798e808

Browse files
authored
ci: Add cross-loongarch64.yml (#313)
1 parent db24332 commit 798e808

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# merge this file into cross.yml
2+
# when we can `sudo apt install gcc-loongarch64-linux-gnu` on ubuntu
3+
name: Cross
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- master
9+
push:
10+
branches:
11+
- master
12+
tags: '*'
13+
14+
jobs:
15+
build-cross-qemu:
16+
# TODO: We need Ubuntu 24.04 to use newer version of qemu,
17+
# switch to ubuntu-latest when `ubuntu-latest >= 24.04`
18+
runs-on: ubuntu-24.04
19+
name: build-cross-qemu-${{ matrix.config.arch }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
config:
24+
- { arch: loongarch64, triple: loongarch64-linux-gnu }
25+
env:
26+
ARCH: ${{ matrix.config.arch }}
27+
TRIPLE: ${{ matrix.config.triple }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Install qemu
31+
run: |
32+
sudo apt update
33+
sudo apt install -y qemu-user qemu-user-binfmt
34+
- name: Install gcc-${{ matrix.config.triple }}
35+
# package gcc-loongarch64-linux-gnu seems not exist
36+
# https://packages.debian.org/sid/amd64/gcc-loongarch64-linux-gnu
37+
run: sudo apt install -y gcc-14-loongarch64-linux-gnu
38+
- name: Build with ${{ matrix.config.triple }}-gcc
39+
run: |
40+
make ARCH=$ARCH TOOLPREFIX=$TRIPLE- \
41+
CC='loongarch64-linux-gnu-gcc-14' \
42+
AR='loongarch64-linux-gnu-gcc-ar-14' \
43+
- name: Build tests
44+
run: |
45+
make -C test ARCH=$ARCH TOOLPREFIX=$TRIPLE- \
46+
CC='loongarch64-linux-gnu-gcc-14' \
47+
AR='loongarch64-linux-gnu-gcc-ar-14' \
48+
- name: Run Tests
49+
env:
50+
QEMU_EXEC: qemu-${{ matrix.config.arch }}
51+
CROSS_LIB: /usr/${{ matrix.config.triple }}
52+
run: |
53+
$QEMU_EXEC -L . -L $CROSS_LIB/ test/test-float
54+
$QEMU_EXEC -L . -L $CROSS_LIB/ test/test-double

0 commit comments

Comments
 (0)