-
-
Notifications
You must be signed in to change notification settings - Fork 118
210 lines (186 loc) · 9.39 KB
/
ci_linux.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: CI Linux
on:
workflow_dispatch:
workflow_call: # This allows it to be called from ci_main.yml
inputs:
libraries:
description: "Build libraries"
type: string
default: '["simpledbus","simplebluez","simpleble"]'
required: false
jobs:
tests:
runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -H apt-get update -y
sudo -H apt-get install -y dbus libdbus-1-dev python3-dev
sudo -H pip3 install -r $GITHUB_WORKSPACE/simpledbus/test/requirements.txt
echo "Runing for libraries: ${{ inputs.libraries }}"
- name: Setup cmake
uses: ./.github/actions/setup-cmake
- name: Setup gtest
uses: ./.github/actions/setup-gtest
- name: Start DBus
run: |
echo "DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --config-file=/usr/share/dbus-1/session.conf --print-address --fork | cut -d, -f1)" >> $GITHUB_ENV
- name: SimpleDBus Unit Tests
if: contains(inputs.libraries, 'simpledbus')
run: |
cmake -B $GITHUB_WORKSPACE/build_unit_simpledbus -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpledbus -DSIMPLEDBUS_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_unit_simpledbus --config Release --parallel 4
$GITHUB_WORKSPACE/build_unit_simpledbus/bin/simpledbus_test
- name: SimpleDBus Unit Tests with Address Sanitizer
if: contains(inputs.libraries, 'simpledbus')
run: |
cmake -B $GITHUB_WORKSPACE/build_asan_simpledbus -DCMAKE_BUILD_TYPE=Debug -DSIMPLEDBUS_SANITIZE=Address -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpledbus -DSIMPLEDBUS_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_asan_simpledbus --config Release --parallel 4
PYTHONMALLOC=malloc $GITHUB_WORKSPACE/build_asan_simpledbus/bin/simpledbus_test
cp "$(ls asan_log.txt.* | head -1)" asan_log.txt || true
(test ! -f asan_log.txt && echo "No ASAN log found") || (cat asan_log.txt && exit 1)
- name: SimpleDBus Unit Tests with Thread Sanitizer
if: contains(inputs.libraries, 'simpledbus')
run: |
cmake -B $GITHUB_WORKSPACE/build_tsan_simpledbus -DCMAKE_BUILD_TYPE=Debug -DSIMPLEDBUS_SANITIZE=Thread -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpledbus -DSIMPLEDBUS_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_tsan_simpledbus --config Release --parallel 4
$GITHUB_WORKSPACE/build_tsan_simpledbus/bin/simpledbus_test
cp "$(ls tsan_log.txt.* | head -1)" tsan_log.txt || true
(test ! -f tsan_log.txt && echo "No TSAN log found") || (cat tsan_log.txt && exit 1)
- name: SimpleBluez Unit Tests
if: contains(inputs.libraries, 'simplebluez')
run: |
cmake -B $GITHUB_WORKSPACE/build_unit_simplebluez -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simplebluez -DSIMPLEBLUEZ_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_unit_simplebluez --config Release --parallel 4
$GITHUB_WORKSPACE/build_unit_simplebluez/bin/simplebluez_test
- name: SimpleBluez Unit Tests with Address Sanitizer
if: contains(inputs.libraries, 'simplebluez')
run: |
cmake -B $GITHUB_WORKSPACE/build_asan_simplebluez -DCMAKE_BUILD_TYPE=Debug -DSIMPLEBLUEZ_SANITIZE=Address -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simplebluez -DSIMPLEBLUEZ_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_asan_simplebluez --config Release --parallel 4
PYTHONMALLOC=malloc $GITHUB_WORKSPACE/build_asan_simplebluez/bin/simplebluez_test
cp "$(ls asan_log.txt.* | head -1)" asan_log.txt || true
(test ! -f asan_log.txt && echo "No ASAN log found") || (cat asan_log.txt && exit 1)
- name: SimpleBluez Unit Tests with Thread Sanitizer
if: contains(inputs.libraries, 'simplebluez')
run: |
cmake -B $GITHUB_WORKSPACE/build_tsan_simplebluez -DCMAKE_BUILD_TYPE=Debug -DSIMPLEBLUEZ_SANITIZE=Thread -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simplebluez -DSIMPLEBLUEZ_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_tsan_simplebluez --config Release --parallel 4
$GITHUB_WORKSPACE/build_tsan_simplebluez/bin/simplebluez_test
cp "$(ls tsan_log.txt.* | head -1)" tsan_log.txt || true
(test ! -f tsan_log.txt && echo "No TSAN log found") || (cat tsan_log.txt && exit 1)
- name: SimpleBLE Unit Tests
if: contains(inputs.libraries, 'simpleble')
run: |
cmake -B $GITHUB_WORKSPACE/build_unit_simpleble -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpleble -DSIMPLEBLE_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_unit_simpleble --config Release --parallel 4
$GITHUB_WORKSPACE/build_unit_simpleble/bin/simpleble_test
examples:
runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo -H apt-get update -y
sudo -H apt-get install -y libdbus-1-dev
env:
DEBIAN_FRONTEND: noninteractive
- name: Setup cmake
uses: ./.github/actions/setup-cmake
- name: Compile SimpleDBus Examples for Ubuntu
if: contains(inputs.libraries, 'simpledbus')
run: |
cmake -B $GITHUB_WORKSPACE/build_simpledbus_examples -DCMAKE_BUILD_TYPE=Release -S $GITHUB_WORKSPACE/examples/simpledbus
cmake --build $GITHUB_WORKSPACE/build_simpledbus_examples --config Release --parallel 4
- name: Compile SimpleBluez Examples for Ubuntu
if: contains(inputs.libraries, 'simplebluez')
run: |
cmake -B $GITHUB_WORKSPACE/build_simplebluez_examples -DCMAKE_BUILD_TYPE=Release -S $GITHUB_WORKSPACE/examples/simplebluez
cmake --build $GITHUB_WORKSPACE/build_simplebluez_examples --config Release --parallel 4
- name: Compile SimpleBLE Examples for Ubuntu
if: contains(inputs.libraries, 'simpleble')
run: |
cmake -B $GITHUB_WORKSPACE/build_simpleble_examples -DCMAKE_BUILD_TYPE=Release -S $GITHUB_WORKSPACE/examples/simpleble
cmake --build $GITHUB_WORKSPACE/build_simpleble_examples --config Release --parallel 4
build:
runs-on: ubuntu-22.04
needs: [tests, examples]
# Skip the job if input is empty. If not there is an error building the matrix and depending jobs will not run:
# 'Error when evaluating 'strategy' for job 'build'. Matrix vector 'library' does not contain any values'
if: ${{ inputs.libraries != '[]' && inputs.libraries != '' }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
# For testing purposes only static libraries are built to reduce run time.
# In release workflow all combinations are build.
options: [
{container: dockcross/linux-x64, target: linux-x64},
{container: dockcross/linux-x86, target: linux-x86},
{container: dockcross/linux-armv6-lts, target: linux-armv6},
]
library: ${{ fromJSON(inputs.libraries) }}
type: [static]
container:
image: ${{ matrix.options.container }}
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Build DBus
uses: ./.github/actions/build-dbus
with:
os: ${{ runner.os }}
arch: ${{ matrix.options.target }}
- name: Build ${{ matrix.library.name }}
run: |
GITHUB_WORKSPACE=$(pwd)
if [ "${{ matrix.type }}" == "shared" ]; then
BUILD_SHARED_LIBS=ON
else
BUILD_SHARED_LIBS=OFF
fi
export CMAKE_PREFIX_PATH=/tmp/dbus/install:$CMAKE_PREFIX_PATH
cmake -B $GITHUB_WORKSPACE/build_${{ matrix.library }} -DCMAKE_BUILD_TYPE=Release -S $GITHUB_WORKSPACE/${{ matrix.library }} -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS
cmake --build $GITHUB_WORKSPACE/build_${{ matrix.library }} --config Release --parallel 4
cmake --install $GITHUB_WORKSPACE/build_${{ matrix.library }} --prefix $GITHUB_WORKSPACE/build_${{ matrix.library }}/install
mkdir -p $GITHUB_WORKSPACE/artifacts
zip -r $GITHUB_WORKSPACE/artifacts/${{ matrix.library }}_${{ matrix.type }}_${{ matrix.options.target }}.zip $GITHUB_WORKSPACE/build_${{ matrix.library }}/install
- name: Upload binaries to job
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.library }}_${{ matrix.type }}_${{ matrix.options.target }}
path: artifacts/${{ matrix.library }}_${{ matrix.type }}_${{ matrix.options.target }}.zip
python:
needs: [tests, examples]
uses: ./.github/workflows/ci_wheels.yml
secrets: inherit
with:
os: ubuntu-22.04
rust:
runs-on: ${{ matrix.os }}
needs: [tests, examples]
strategy:
fail-fast: false
max-parallel: 4
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo -H apt-get update -y
sudo -H apt-get install -y libdbus-1-dev
env:
DEBIAN_FRONTEND: noninteractive
- name: Setup cmake
uses: ./.github/actions/setup-cmake
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Compile SimpleBLE
run: cargo build