-
-
Notifications
You must be signed in to change notification settings - Fork 121
154 lines (135 loc) · 7.14 KB
/
ci_test.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
name: CI Test
on: [push, pull_request]
jobs:
# ------------------------------------------------------------
test-windows:
runs-on: windows-2022
steps:
- name: Clone Repository
uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Clone and build GTest
run: |
git clone https://github.com/google/googletest
cd %GITHUB_WORKSPACE%\googletest
cmake . -B build -Dgtest_force_shared_crt=ON
cmake --build .\build --config Release --parallel 4
cmake --install .\build --prefix .\install
shell: cmd
- name: Compile Tests for Windows x86
run: |
cmake -B %GITHUB_WORKSPACE%\build_test -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION=10.0.22000.0 -DGTEST_ROOT=%GITHUB_WORKSPACE%\googletest\install -S %GITHUB_WORKSPACE%/simpleble -DSIMPLEBLE_TEST=ON
cmake --build %GITHUB_WORKSPACE%\build_test --config Release --parallel 4
%GITHUB_WORKSPACE%\build_test\bin\Release\simpleble_test.exe
shell: cmd
# ------------------------------------------------------------
test-macos:
runs-on: macos-12
steps:
- name: Clone Repository
uses: actions/checkout@v3
- name: Setup Cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.21'
- name: Clone and build GTest
run: |
git clone https://github.com/google/googletest
cd $GITHUB_WORKSPACE/googletest
cmake . -B build
cmake --build ./build --config Release --parallel 4
cmake --install ./build --prefix ./install
- name: Compile Tests for MacOS arm64
run: |
cmake -B $GITHUB_WORKSPACE/build_test -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpleble -DSIMPLEBLE_TEST=ON
cmake --build $GITHUB_WORKSPACE/build_test --config Release --parallel 4
$GITHUB_WORKSPACE/build_test/bin/simpleble_test
# ------------------------------------------------------------
test-linux:
runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v3
- 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
- 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: Setup Cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.21'
- name: Clone and build GTest
run: |
git clone https://github.com/google/googletest
cd $GITHUB_WORKSPACE/googletest
cmake . -B build
cmake --build ./build --config Release --parallel 4
cmake --install ./build --prefix ./install
- name: SimpleBLE Unit Tests
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
- name: SimpleBluez Unit Tests
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
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
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: SimpleDBus Unit Tests
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
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
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)
# ------------------------------------------------------------
test-python:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: "pip"
- name: Install dependencies
run: pip install -r simplepyble/requirements.txt
- name: Install SimplePyBLE with Plain flavor
run: python setup.py install --plain
- name: Run PyTest
run: pytest
working-directory: ./simplepyble/test