Skip to content

Commit b60308f

Browse files
committed
Add cross build CI workflow.
1 parent e9f0617 commit b60308f

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

.github/workflows/CrossBuilds.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Run Test
2+
on:
3+
push:
4+
paths-ignore:
5+
- ".gitignore"
6+
- "docs/**"
7+
- "ChangeLog"
8+
- "CREDITS.TXT"
9+
- "COMPILE_MAKE.TXT"
10+
- "BUILDING.md"
11+
- "CONTRIBUTING.md"
12+
- "LICENSE.TXT"
13+
- "LICENSE_LLVM.TXT"
14+
- "README.md"
15+
- "RELEASE_NOTES"
16+
- "SPONSORS.TXT"
17+
- "TODO"
18+
pull_request:
19+
20+
# Stop previous runs on the same branch on new push
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
env:
26+
CI: true
27+
UBSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
28+
ASAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
29+
LSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
30+
31+
jobs:
32+
Linux:
33+
runs-on: ${{ matrix.config.os }}
34+
name: ${{ matrix.config.name }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
config:
39+
- {
40+
name: 'QEMU Linux s390x',
41+
os: ubuntu-24.04,
42+
arch: x64,
43+
cross_file: 'cross_configs/linux_s390x_ubuntu24.cmake',
44+
qemu: 'qemu-user-static-s390x'
45+
}
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: ${{ matrix.config.python-version }}
54+
55+
- name: Install cross build dependencies
56+
packages: ${{ matrix.config.packages }}
57+
run:
58+
sudo apt-get install -y ${packages}
59+
60+
- name: cmake (cross build)
61+
env:
62+
build_option: ${{ matrix.config.build_option }}
63+
build_type: ${{ matrix.config.build_type }}
64+
cross_file: ${{ matrix.config.cross_file }}
65+
run: |
66+
mkdir build && cd build
67+
# build static library
68+
cmake -DCMAKE_BUILD_TYPE=${build_type} -DCAPSTONE_INSTALL=1 -DCMAKE_INSTALL_PREFIX=/usr -DCAPSTONE_BUILD_DIET=${diet_build} -DCMAKE_TOOLCHAIN_FILE=${cross_file} ${build_option} ..
69+
sudo cmake --build . --config ${build_type} --target install
70+
71+
- name: unit tests
72+
if: startsWith(matrix.config.build-system, 'cmake')
73+
run: |
74+
ctest --test-dir build --output-on-failure -R unit_*
75+
76+
- name: "Integration tests"
77+
if: startsWith(matrix.config.build-system, 'cmake') && matrix.config.diet-build == 'OFF'
78+
run: |
79+
ctest --test-dir build --output-on-failure -R integration_*
80+
81+
- name: cstool - reaches disassembler engine
82+
run: |
83+
sh suite/run_invalid_cstool.sh
84+
85+
- name: cstest MC
86+
if: startsWith(matrix.config.build-system, 'cmake')
87+
run: |
88+
ctest --test-dir build --output-on-failure -R MCTests
89+
90+
- name: cstest details
91+
if: startsWith(matrix.config.build-system, 'cmake')
92+
run: |
93+
ctest --test-dir build --output-on-failure -R DetailTests
94+
95+
- name: cstest issues
96+
if: startsWith(matrix.config.build-system, 'cmake')
97+
run: |
98+
ctest --test-dir build --output-on-failure -R IssueTests
99+
100+
- name: cstest features
101+
if: startsWith(matrix.config.build-system, 'cmake')
102+
run: |
103+
ctest --test-dir build --output-on-failure -R FeaturesTests
104+
105+
- name: Legacy integration tests
106+
if: startsWith(matrix.config.build-system, 'cmake')
107+
run: |
108+
ctest --test-dir build --output-on-failure -R legacy*

cross_configs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Cross Compilation Configs
22

33
This directory holds example cross compilation configs for cmake.
4+
5+
Files are named like: `<targetOS>_<targetMachine>_<hostOS>.cmake`
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This example file is for build on Ubunutu 24.04.
2+
# Search for required packages (compiler + libc) with `apt search s390x`
3+
set(CMAKE_C_COMPILER /usr/bin/s390x-linux-gnu-gcc)
4+
set(CMAKE_ASM_COMPILER /usr/bin/s390x-linux-gnu-gcc)
5+
set(CMAKE_CROSS_COMPILING 1)
6+
7+
set(CMAKE_SYSROOT /usr/s390x-linux-gnu/)
8+
set(CMAKE_FIND_ROOT_PATH /usr/s390x-linux-gnu/)
9+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
10+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
11+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
12+

0 commit comments

Comments
 (0)