-
-
Notifications
You must be signed in to change notification settings - Fork 121
161 lines (124 loc) · 5.73 KB
/
ci_cpp_release_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
155
156
157
158
159
160
161
name: Cpp Release Test
on: [push, pull_request]
jobs:
# ------------------------------------------------------------
cpp-release-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
library: [
{lib: simpledbus, name: SimpleDBus},
{lib: simplebluez, name: SimpleBluez},
{lib: simpleble, name: SimpleBLE},
]
options: [
{container: dockcross/linux-x64, target: linux-x64},
{container: dockcross/linux-x86, target: linux-x86},
{container: dockcross/linux-armv6-lts, target: linux-armv6},
]
type: [shared, static]
container:
image: ${{ matrix.options.container }}
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Build Expat
run: |
git clone https://github.com/libexpat/libexpat.git /tmp/libexpat
cd /tmp/libexpat/expat
cmake -B /tmb/expat/build -S /tmp/libexpat/expat -DEXPAT_BUILD_DOCS=OFF -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_BUILD_TESTS=OFF
cmake --build /tmb/expat/build --config Release --parallel 4
cmake --install /tmb/expat/build --prefix /tmp/expat/install
- name: Build DBus
run: |
git clone https://gitlab.freedesktop.org/dbus/dbus.git /tmp/dbus
export CMAKE_PREFIX_PATH=/tmp/expat/install:$CMAKE_PREFIX_PATH
cmake -B /tmb/dbus/build -S /tmp/dbus -DDBUS_SESSION_SOCKET_DIR=/usr/local/var/run/dbus/system_bus_socket -DDBUS_BUILD_TESTS=OFF
cmake --build /tmb/dbus/build --config Release --parallel 4
cmake --install /tmb/dbus/build --prefix /tmp/dbus/install
- 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.lib }} -DCMAKE_BUILD_TYPE=Release -S $GITHUB_WORKSPACE/${{ matrix.library.lib }} -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS
cmake --build $GITHUB_WORKSPACE/build_${{ matrix.library.lib }} --config Release --parallel 4
cmake --install $GITHUB_WORKSPACE/build_${{ matrix.library.lib }} --prefix $GITHUB_WORKSPACE/build_${{ matrix.library.lib }}/install
mkdir -p $GITHUB_WORKSPACE/artifacts
zip -r $GITHUB_WORKSPACE/artifacts/${{ matrix.library.lib }}_${{ matrix.type }}_${{ matrix.options.target }}.zip $GITHUB_WORKSPACE/build_${{ matrix.library.lib }}/install
- name: Upload binaries to job
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.library.lib }}_${{ matrix.type }}_${{ matrix.options.target }}
path: artifacts/${{ matrix.library.lib }}_${{ matrix.type }}_${{ matrix.options.target }}.zip
# ------------------------------------------------------------
cpp-release-windows:
runs-on: windows-2022
strategy:
fail-fast: false
max-parallel: 4
matrix:
arch: [Win32, x64]
type: [shared, static]
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Compile SimpleBLE
shell: cmd
run: |
if "${{ matrix.type }}" == "shared" (
set BUILD_SHARED_LIBS=ON
) else (
set BUILD_SHARED_LIBS=OFF
)
cmake -B %GITHUB_WORKSPACE%\build -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DCMAKE_SYSTEM_VERSION="10.0.19041.0" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -S %GITHUB_WORKSPACE%/simpleble
cmake --build %GITHUB_WORKSPACE%\build --config Release --parallel 4
cmake --install %GITHUB_WORKSPACE%\build --prefix %GITHUB_WORKSPACE%\build\install
mkdir -p $GITHUB_WORKSPACE\artifacts
7z a -tzip %GITHUB_WORKSPACE%\artifacts\simpleble_${{ matrix.type }}_windows-${{ matrix.arch }}.zip %GITHUB_WORKSPACE%\build\install
- name: Upload binaries to job
uses: actions/upload-artifact@v3
with:
name: simpleble_${{ matrix.type }}_windows-${{ matrix.arch }}
path: artifacts/simpleble_${{ matrix.type }}_windows-${{ matrix.arch }}.zip
# ------------------------------------------------------------
cpp-release-macos:
runs-on: macos-12
strategy:
fail-fast: false
max-parallel: 4
matrix:
arch: [arm64, x86_64]
type: [shared, static]
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Setup CMake
uses: jwlawson/[email protected]
with:
cmake-version: '3.21'
- name: Compile SimpleBLE
run: |
if [ "${{ matrix.type }}" = "shared" ]; then
BUILD_SHARED_LIBS=ON
else
BUILD_SHARED_LIBS=OFF
fi
cmake -B $GITHUB_WORKSPACE/build -DCMAKE_OSX_ARCHITECTURES="${{ matrix.arch }}" -DCMAKE_BUILD_TYPE=Release -S $GITHUB_WORKSPACE/simpleble -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS
cmake --build $GITHUB_WORKSPACE/build --config Release --parallel 4
cmake --install $GITHUB_WORKSPACE/build --prefix $GITHUB_WORKSPACE/build/install
mkdir -p $GITHUB_WORKSPACE/artifacts
zip -r $GITHUB_WORKSPACE/artifacts/simpleble_${{ matrix.type }}_macos-${{ matrix.arch }}.zip $GITHUB_WORKSPACE/build/install
- name: Upload binaries to job
uses: actions/upload-artifact@v3
with:
name: simpleble_${{ matrix.type }}_macos-${{ matrix.arch }}
path: artifacts/simpleble_${{ matrix.type }}_macos-${{ matrix.arch }}.zip