-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (68 loc) · 2.86 KB
/
cross-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: cross-build
on:
workflow_call:
jobs:
cross-build:
strategy:
matrix:
arch:
# Disabled because there is no linux/arm/v5 image of ubuntu.
# - armel
- armhf
- arm64
include:
# - arch: armel
# host-triple: arm-linux-gnueabi
# elf-machine: 'ARM'
# elf-flags: 'soft-float'
# docker-platform: linux/arm/v5
- arch: armhf
host-triple: arm-linux-gnueabihf
elf-machine: 'ARM'
elf-flags: 'hard-float'
docker-platform: linux/arm/v7
- arch: arm64
host-triple: aarch64-linux-gnu
elf-machine: 'AArch64'
elf-flags: ''
docker-platform: linux/arm64/v8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache for external projects
uses: actions/cache@v4
with:
path: build/vendor
key: ${{ runner.os }}-cross-build-${{ matrix.arch }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-cross-build-${{ matrix.arch }}-
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends autoconf automake cmake dos2unix g++-${{ matrix.host-triple }} libtool make ninja-build pkg-config
- name: Generate project files
run: |
cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release -D MIRAKC_ARIB_TEST=ON -D CMAKE_TOOLCHAIN_FILE=toolchain.cmake.d/debian-${{ matrix.arch }}.cmake .
- name: Build vendor libraries
run: |
ninja -C build vendor
- name: Build
run: |
ninja -C build
- name: Check the binary format
run: |
readelf -h build/bin/mirakc-arib | grep Machine | grep '${{ matrix.elf-machine }}'
readelf -h build/bin/mirakc-arib | grep Flags | grep '${{ matrix.elf-flags }}'
- name: Setup QEMU user-mode emulation
uses: docker/setup-qemu-action@v3
- name: Show help and version
run: |
sudo apt-get install -y --no-install-recommends lsb-release
docker run --rm -v $(pwd)/build:/build --platform ${{ matrix.docker-platform }} ubuntu:$(lsb_release -cs) /build/bin/mirakc-arib -h
docker run --rm -v $(pwd)/build:/build --platform ${{ matrix.docker-platform }} ubuntu:$(lsb_release -cs) /build/bin/mirakc-arib --version
- name: Run tests
run: |
docker run --rm -e CI=$CI -v $(pwd)/build:/build --platform ${{ matrix.docker-platform }} ubuntu:$(lsb_release -cs) /build/bin/mirakc-arib-test --gtest_shuffle
docker run --rm -e CI=$CI -v $(pwd)/build:/build -v $(pwd)/test:/test --platform ${{ matrix.docker-platform }} ubuntu:$(lsb_release -cs) sh /test/cli_tests.sh /build/bin/mirakc-arib