-
Notifications
You must be signed in to change notification settings - Fork 13
234 lines (223 loc) · 8.88 KB
/
builds.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: CI
on:
push:
branches: [main, v1.0.*]
pull_request:
branches: [main, v1.0.*]
jobs:
ubuntu-build:
runs-on: ubuntu-latest
env:
# set_option known to fail on Github Actions
COMMON_CTEST_ARGS: ---no-compress-output --output-on-failure -E "^set_option$"
steps:
- uses: actions/checkout@v3
with:
path: src
- name: Install dependencies
run: |
sudo apt update
sudo apt install libudev-dev ninja-build
- name: Configure
run: |
rm -rf build install
cmake -B build/shared -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON
cmake -B build/static -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF
- name: Build Shared
working-directory: build/shared
run: ninja install
- name: Build Static
working-directory: build/static
run: ninja install
- name: Check artifacts
uses: andstor/file-existence-action@v2
with:
files: "install/shared/lib/libusb-1.0.so, \
install/shared/include/libusb-1.0/libusb.h, \
install/static/lib/libusb-1.0.a, \
install/shared/include/libusb-1.0/libusb.h"
fail: true
- name: Test Shared
if: always()
working-directory: build/shared
run: ctest --output-junit test_shared.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Test Static
if: always()
working-directory: build/static
run: ctest --output-junit test_static.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results Ubuntu
path: |
build/shared/test_shared.xml
build/static/test_static.xml
macos-buid:
runs-on: macos-latest
env:
COMMON_CTEST_ARGS: --no-compress-output --output-on-failure
steps:
- uses: actions/checkout@v3
with:
path: src
- name: Install dependencies
run: brew install ninja
- name: Configure
run: |
rm -rf build install
cmake -B build/shared -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON
cmake -B build/static -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF
- name: Build Shared
working-directory: build/shared
run: ninja install
- name: Build Static
working-directory: build/static
run: ninja install
- name: Check artifacts
uses: andstor/file-existence-action@v2
with:
files: "install/shared/lib/libusb-1.0.dylib, \
install/shared/include/libusb-1.0/libusb.h, \
install/static/lib/libusb-1.0.a, \
install/shared/include/libusb-1.0/libusb.h"
fail: true
- name: Test Shared
if: always()
working-directory: build/shared
run: ctest --output-junit test_shared.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Test Static
if: always()
working-directory: build/static
run: ctest --output-junit test_static.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results macOS
path: |
build/shared/test_shared.xml
build/static/test_static.xml
windows-msvc-buid:
runs-on: windows-latest
env:
COMMON_CTEST_ARGS: --no-compress-output --output-on-failure
VCVARS64_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat'
steps:
- uses: actions/checkout@v3
with:
path: src
- name: Install dependencies
run: choco install ninja
- name: Configure Visual Studio
run: |
cmake -B build/msvc -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/msvc -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON
- name: Configure NMake/Ninja
shell: cmd
run: |
call "${{ env.VCVARS64_PATH }}"
cmake -G"NMake Makefiles" -B build\nmake_shared -DCMAKE_INSTALL_PREFIX=install/nmake_shared -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON
cmake -G"NMake Makefiles" -B build\nmake_static -DCMAKE_INSTALL_PREFIX=install/nmake_static -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF
cmake -GNinja -B build\ninja_shared -DCMAKE_INSTALL_PREFIX=install/ninja_shared -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON
cmake -GNinja -B build\ninja_static -DCMAKE_INSTALL_PREFIX=install/ninja_static -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF
- name: Build Visual Studio
working-directory: build/msvc
run: cmake --build . --config RelWithDebInfo --target install
- name: Build NMake Shared
working-directory: build/nmake_shared
shell: cmd
run: |
call "${{ env.VCVARS64_PATH }}"
nmake install
- name: Build NMake Static
working-directory: build/nmake_static
shell: cmd
run: |
call "${{ env.VCVARS64_PATH }}"
nmake install
- name: Build Ninja Shared
working-directory: build/ninja_shared
shell: cmd
run: |
call "${{ env.VCVARS64_PATH }}"
ninja install
- name: Build Ninja Static
working-directory: build/ninja_static
shell: cmd
run: |
call "${{ env.VCVARS64_PATH }}"
ninja install
- name: Check artifacts
uses: andstor/file-existence-action@v2
with:
files: "install/msvc/lib/usb-1.0.lib, \
install/msvc/bin/libusb-1.0.dll, \
install/msvc/include/libusb-1.0/libusb.h, \
install/nmake_shared/lib/usb-1.0.lib, \
install/nmake_shared/bin/libusb-1.0.dll, \
install/nmake_shared/include/libusb-1.0/libusb.h, \
install/nmake_static/lib/libusb-1.0.lib, \
install/nmake_static/include/libusb-1.0/libusb.h, \
install/ninja_shared/lib/usb-1.0.lib, \
install/ninja_shared/bin/libusb-1.0.dll, \
install/ninja_shared/include/libusb-1.0/libusb.h, \
install/ninja_static/lib/libusb-1.0.lib, \
install/ninja_static/include/libusb-1.0/libusb.h"
fail: true
- name: Test Visual Studio
if: always()
working-directory: build/msvc
shell: cmd
run: |
set PATH=%PATH%;${{ github.workspace }}\install\msvc\bin
ctest -C RelWithDebInfo --output-junit test_msvc.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Test NMake Shared
if: always()
working-directory: build/nmake_shared
shell: cmd
run: |
set PATH=%PATH%;${{ github.workspace }}\install\nmake_shared\bin
ctest --output-junit test_nmake_shared.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Test NMake Static
if: always()
working-directory: build/nmake_static
run: ctest --output-junit test_nmake_static.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Test Ninja Shared
if: always()
working-directory: build/ninja_shared
shell: cmd
run: |
set PATH=%PATH%;${{ github.workspace }}\install\ninja_shared\bin
ctest --output-junit test_ninja_shared.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Test Ninja Static
if: always()
working-directory: build/ninja_static
run: ctest --output-junit test_ninja_static.xml ${{ env.COMMON_CTEST_ARGS }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results MSVC
path: |
build/msvc/test_msvc.xml
build/nmake_shared/test_nmake_shared.xml
build/nmake_static/test_nmake_static.xml
build/ninja_shared/test_ninja_shared.xml
build/ninja_static/test_ninja_static.xml
publish-test-results:
name: "Publish Tests Results"
needs: [ubuntu-build, macos-buid, windows-msvc-buid]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"