-
-
Notifications
You must be signed in to change notification settings - Fork 58
268 lines (232 loc) · 6.95 KB
/
continuous-integration.yaml
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
name: Build and run tests
on:
create:
tags:
-v*
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: "Tests"
strategy:
fail-fast: false
matrix:
include:
- name: "Linux GCC"
os: ubuntu-latest
compiler: gcc
test: true
- name: "Linux Clang"
os: ubuntu-latest
compiler: llvm
test: true
- name: "MacOS clang"
os: macos-latest
test: true
compiler: llvm
- name: "Windows"
os: windows-latest
compiler: cl
- name: "WebAssembly"
os: ubuntu-latest
emscripten: true
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Setup Cpp"
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
clangtidy: false
cppcheck: false
gcovr: "5.0"
opencppcoverage: false
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: '17'
check-latest: true
- name: "Install Linux Dependencies"
if: ${{ runner.os == 'Linux' }}
run: sudo apt install libboost-graph-dev uuid-dev
- name: "Install boost for windows"
if: ${{ runner.os == 'Windows' }}
uses: MarkusJx/[email protected]
with:
boost_version: 1.81.0
platform_version: 2022
toolset: msvc
- name: "Install dependencies for macOS"
if: ${{ runner.os == 'macOS' }}
run: |
brew install gcc
brew install boost
- name: "Setup Emscripten"
if: ${{ matrix.emscripten }}
uses: mymindstorm/setup-emsdk@v7
- name: "Configure emscripten"
if: ${{ matrix.emscripten }}
run: >
emcmake cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure build only"
if: ${{ !matrix.emscripten && !matrix.test}}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure buil and tests"
if: ${{ !matrix.emscripten && matrix.test}}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug
-DDIAGON_BUILD_TESTS:BOOL=ON
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Build"
run: >
cmake --build ./build;
- name: "Run tests"
if: ${{ matrix.test}}
run: >
cd build;
./input_output_test;
# Create a release on new v* tags
release:
needs: test
if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }}
name: "Create release"
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: "Create release"
uses: softprops/action-gh-release@v1
id: create_release
with:
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build artifact for the release
package:
name: "Build packages"
needs: release
strategy:
matrix:
include:
- name: "Linux Clang"
os: ubuntu-latest
compiler: llvm
asset_path: build/diagon*Linux*
- name: "WebAssembly"
os: ubuntu-latest
emscripten: true
asset_path: build/diagon-Web.zip
- name: "MacOS"
os: macos-latest
compiler: llvm
asset_path: build/diagon*Darwin*
- name: "Windows"
os: windows-latest
compiler: cl
asset_path: build/diagon*Win64*
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Setup Cpp"
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
clangtidy: false
cppcheck: false
gcovr: "5.0"
opencppcoverage: false
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: '17'
check-latest: true
- name: "Install Linux Dependencies"
if: ${{ runner.os == 'Linux' }}
run: sudo apt install libboost-graph-dev uuid-dev
- name: "Install boost for windows"
if: ${{ runner.os == 'Windows' }}
uses: MarkusJx/[email protected]
with:
boost_version: 1.81.0
platform_version: 2022
toolset: msvc
- name: "Install dependencies for macOS"
if: ${{ runner.os == 'macOS' }}
run: |
brew install gcc
brew install boost
- name: "Setup Emscripten"
if: ${{ matrix.emscripten }}
uses: mymindstorm/setup-emsdk@v7
- name: "Configure cmake with emscripten"
if: ${{ matrix.emscripten }}
run: >
emcmake cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure CMake"
if: ${{ !matrix.emscripten }}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Build"
run: >
cmake
--build ./build
--target package;
- name: "Upload native binaries"
uses: shogo82148/actions-upload-release-asset@v1
if: ${{ !matrix.emscripten }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true
- name: "Make webAssembly distribution"
if: ${{ matrix.emscripten }}
run: >
cd build;
mkdir -p diagon-Web;
cp diagon.js diagon-Web;
cp diagon*wasm diagon-Web;
cp index.html diagon-Web;
cp style.css diagon-Web;
cp run_diagon.sh diagon-Web;
chmod a+x ./diagon-Web/run_diagon.sh;
zip -r diagon-Web.zip diagon-Web;
- name: "Upload WebAssembly distribution"
if: ${{ matrix.emscripten }}
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true