1
1
# TODO: check if qemu-user-static-binfmt is needed (perhaps to run some tests since it probably calls exec).
2
2
3
- name : m68k CI
3
+ name : Cross-compilation CI
4
4
5
5
on :
6
6
push :
22
22
strategy :
23
23
fail-fast : false
24
24
matrix :
25
+ arch : [
26
+ {
27
+ gcc : " aarch64" ,
28
+ qemu : " aarch64" ,
29
+ triple : " aarch64-unknown-linux-gnu" ,
30
+ vm : " arm64" ,
31
+ },
32
+ {
33
+ gcc : " m68k" ,
34
+ qemu : " m68k" ,
35
+ triple : " m68k-unknown-linux-gnu" ,
36
+ vm : " m68k" ,
37
+ },
38
+ ]
25
39
commands : [
26
40
" --std-tests" ,
27
41
# TODO(antoyo): fix those on m68k.
@@ -50,14 +64,14 @@ jobs:
50
64
sudo apt-get install qemu-system qemu-user-static
51
65
52
66
- name : Download artifact
53
- run : curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-m68k -15.deb
67
+ run : curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-${{ matrix.arch.gcc }} -15.deb
54
68
55
69
- name : Download VM artifact
56
- run : curl -LO https://github.com/cross-cg-gcc-tools/vms/releases/latest/download/debian-m68k .img
70
+ run : curl -LO https://github.com/cross-cg-gcc-tools/vms/releases/latest/download/debian-${{ matrix.arch.vm }} .img
57
71
58
72
- name : Setup path to libgccjit
59
73
run : |
60
- sudo dpkg --force-overwrite -i gcc-m68k -15.deb
74
+ sudo dpkg --force-overwrite -i gcc-${{ matrix.arch.gcc }} -15.deb
61
75
echo 'gcc-path = "/usr/lib/"' > config.toml
62
76
63
77
- name : Set env
@@ -76,22 +90,23 @@ jobs:
76
90
- name : Prepare VM
77
91
run : |
78
92
mkdir vm
79
- sudo mount debian-m68k .img vm
80
- sudo cp $(which qemu-m68k -static) vm/usr/bin/
93
+ sudo mount debian-${{ matrix.arch.vm }} .img vm
94
+ sudo cp $(which qemu-${{ matrix.arch.qemu }} -static) vm/usr/bin/
81
95
82
96
- name : Build sample project with target defined as JSON spec
97
+ if : matrix.arch.gcc == 'm68k'
83
98
run : |
84
99
./y.sh prepare --only-libcore --cross
85
- ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
100
+ ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple ${{ matrix.arch.triple }} --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
86
101
CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ./y.sh cargo build --manifest-path=./tests/hello-world/Cargo.toml --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
87
102
./y.sh clean all
88
103
89
104
- name : Build
90
105
run : |
91
106
./y.sh prepare --only-libcore --cross
92
- ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
93
- ./y.sh test --mini-tests --target-triple m68k-unknown-linux-gnu
94
- CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu . /y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
107
+ ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple ${{ matrix.arch.triple }}
108
+ ./y.sh test --mini-tests --target-triple ${{ matrix.arch.triple }}
109
+ CG_GCC_TEST_TARGET=${{ matrix.arch.triple }} . /y.sh test --cargo-tests --target-triple ${{ matrix.arch.triple }}
95
110
./y.sh clean all
96
111
97
112
- name : Prepare dependencies
@@ -102,17 +117,17 @@ jobs:
102
117
103
118
- name : Run tests
104
119
run : |
105
- ./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot --sysroot-features compiler_builtins/no-f16-f128 ${{ matrix.commands }}
120
+ ./y.sh test --target-triple ${{ matrix.arch.triple }} --release --clean --build-sysroot --sysroot-features compiler_builtins/no-f16-f128 ${{ matrix.commands }}
106
121
107
122
- name : Run Hello World!
108
123
run : |
109
- ./y.sh build --target-triple m68k-unknown-linux-gnu
124
+ ./y.sh build --target-triple ${{ matrix.arch.triple }}
110
125
111
126
vm_dir=$(pwd)/vm
112
127
cd tests/hello-world
113
- CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu- gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
114
- sudo cp target/m68k-unknown-linux-gnu /debug/hello_world $vm_dir/home/
115
- sudo chroot $vm_dir qemu-m68k -static /home/hello_world > hello_world_stdout
128
+ CG_RUSTFLAGS="-Clinker=${{ matrix.arch.triple }}- gcc" ../../y.sh cargo build --target ${{ matrix.arch.triple }}
129
+ sudo cp target/${{ matrix.arch.triple }} /debug/hello_world $vm_dir/home/
130
+ sudo chroot $vm_dir qemu-${{ matrix.arch.qemu }} -static /home/hello_world > hello_world_stdout
116
131
expected_output="40"
117
132
test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
118
133
0 commit comments