forked from mavlink-router/mavlink-router
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (129 loc) · 5.03 KB
/
main.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build and Test
on:
push:
pull_request:
branches: [master]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check on src directory
uses: jidicula/[email protected]
with:
clang-format-version: "13"
check-path: "src"
build:
runs-on: ubuntu-20.04
needs: [formatting-check]
strategy:
matrix:
include:
- name: armhf
arch: arm-linux-gnueabihf
- name: aarch64
arch: aarch64-linux-gnu
- name: x86_64
arch: native
- name: i686
arch: native
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # otherwise the version header just contains the commit hash
- name: install dependencies (native)
if: ${{ matrix.arch == 'native' }}
run: |
if [ "${{ matrix.name }}" == "i686" ]; then
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --yes libgtest-dev:i386
else
sudo apt-get update
sudo apt-get install --yes libgtest-dev
fi
sudo apt-get install --yes pkg-config gcc-multilib g++-multilib ninja-build python3-pip
pip3 install meson pymavlink
- name: install dependencies (cross)
if: ${{ matrix.arch != 'native' }}
run: |
sudo apt-get update
sudo apt-get install --yes ninja-build gcc-${{ matrix.arch }} g++-${{ matrix.arch }} podman python3-pip
pip3 install meson pymavlink
- name: prepare sysroot
if: ${{ matrix.arch != 'native' }}
run: |
mkdir rootfs
tools/ci-create-rootfs.sh ${{ matrix.name }} > rootfs.tar
tar -xf rootfs.tar --directory=rootfs
sed -e "s#@sysroot@#$PWD/rootfs#g" meson-cross-sysroot.ini.in > meson-cross-sysroot.ini
- name: configure (native)
if: ${{ matrix.arch == 'native' }}
run: |
export PKG_CONFIG=$PWD/tools/meson-native-ubuntu-pkg-config
if [ "${{ matrix.name }}" == "i686" ]; then
export PATH="$PWD/tools:$PATH"
meson setup --werror --cross-file meson-cross-i686.ini -Dsystemdsystemunitdir=/usr/lib/systemd/system build-${{ matrix.name }} .
else
meson setup --werror build-${{ matrix.name }} .
fi
- name: configure (cross)
if: ${{ matrix.arch != 'native' }}
run: meson setup --werror -Dsystemdsystemunitdir=/usr/lib/systemd/system --cross-file meson-cross-${{ matrix.name }}.ini --cross-file meson-cross-sysroot.ini build-${{ matrix.name }} .
- name: build
run: ninja -C build-${{ matrix.name }}
- name: test
if: ${{ matrix.arch == 'native' }}
run: ninja -C build-${{ matrix.name }} test
- name: install
run: DESTDIR=./.debpkg ninja -C build-${{ matrix.name }} install
- name: run routing_test.py
if: ${{ matrix.arch == 'native' }}
run: ./tests/routing_test.py -b ./build-${{ matrix.name }}/src/mavlink-routerd
- uses: actions/upload-artifact@master
with:
path: build-${{ matrix.name }}/src/mavlink-routerd
name: mavlink-routerd-glibc-${{ matrix.name }}
- uses: svenstaro/upload-release-action@v2
name: Upload binaries to release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build-${{ matrix.name }}/src/mavlink-routerd
asset_name: mavlink-routerd-glibc-${{ matrix.name }}
tag: ${{ github.ref }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
overwrite: true
alpine-linux:
name: alpine 3.14 (musl)
runs-on: ubuntu-20.04
needs: [formatting-check]
container: alpine:3.14
steps:
- name: install dependencies
run: apk update && apk add build-base git linux-headers pkgconf meson ninja
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # otherwise the version header just contains the commit hash
- name: configure
run: meson setup --werror -Dsystemdsystemunitdir=/usr/lib/systemd/system build .
- name: build
run: ninja -C build
- name: Rename
run: cp build/src/mavlink-routerd build/src/mavlink-routerd-musl-x86-64
- uses: actions/upload-artifact@master
with:
path: build/src/mavlink-routerd-musl-x86-64
name: mavlink-routerd-musl-x86-64
- uses: svenstaro/upload-release-action@v2
name: Upload binaries to release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/src/mavlink-routerd-musl-x86-64
tag: ${{ github.ref }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
overwrite: true