-
Notifications
You must be signed in to change notification settings - Fork 3
330 lines (287 loc) · 10.1 KB
/
gempyre.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
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
name: CMake Build Matrix
on: [push]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC", artifact: "Gempyre-Windows-MSVC.tar.xz",
os: windows-latest,
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
generators: "Visual Studio 17 2022"
}
- {
name: "Windows Latest MinGW", artifact: "Gempyre-Windows-MinGW.tar.xz",
os: windows-latest,
build_type: "Release", cc: "gcc", cxx: "g++",
generators: "Ninja"
}
- {
name: "Ubuntu Latest GCC", artifact: "Gempyre-Linux.tar.xz",
os: ubuntu-latest,
build_type: "Release", cc: "gcc", cxx: "g++",
generators: "Ninja"
}
- {
name: "macOS Latest Clang", artifact: "Gempyre-macOS.tar.xz",
os: macos-latest,
build_type: "Release", cc: "clang", cxx: "clang++",
generators: "Ninja"
}
steps:
- uses: actions/checkout@v3
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ninja cmake
ninja --version
cmake --version
- name: Install dependencies on ubuntu
if: startsWith(matrix.config.name, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install libegl1-mesa
sudo apt-get install doxygen
sudo apt-get install graphviz
sudo apt-get install ninja-build cmake
sudo apt-get install aspell
ninja --version
cmake --version
gcc --version
- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install cmake ninja
ninja --version
cmake --version
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
message("Currenly: ${CMAKE_CURRENT_SOURCE_DIR}, ${CMAKE_CURRENT_LIST_DIR}")
# is this really executed?
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
if ("${{ matrix.config.os }}" STREQUAL "ubuntu-latest")
set(DOX "-DDOXYGEN=1")
endif()
execute_process(
COMMAND cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCI_ACTIONS=ON -G Ninja -DACTIONS=TRUE ${DOX} -DCMAKE_INSTALL_PREFIX=install_dir
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
execute_process(
COMMAND cmake --build build
RESULT_VARIABLE result
OUTPUT_VARIABLE build_out
ERROR_VARIABLE build_out
)
message("build out: ${build_out}")
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Deploy docs
if: startsWith(matrix.config.name, 'ubuntu')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/html
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1
- name: Setup DISPLAY
if: startsWith(matrix.config.os, 'ubuntu')
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
#- name: Run tests
# shell: cmake -P {0}
# run: |
# execute_process(
# COMMAND ctest -j 1 --timeout 60 --verbose
# WORKING_DIRECTORY build
# RESULT_VARIABLE result
# )
# if (NOT result EQUAL 0)
# message(WARNING "Running tests failed!")
# endif()
- name: Run Unit tests
shell: bash
run: |
build/test/unittests/unittests
- name: Run API tests
if: "! startsWith(matrix.config.os, 'windows')"
shell: bash
run: |
build/test/apitests/apitests --verbose
- name: Find dumpbin
if: startsWith(matrix.config.os, 'windows')
shell: bash
run: |
find "/c/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC" -name dumpbin.exe 2>/dev/null || echo "dumpbin not found"
- name: Run lib install test
if: startsWith(matrix.config.os, 'ubuntu')
shell: bash
run: |
mkdir -p clean_build
pushd clean_build
cmake .. -DNO_INSTALL_TEST=1 -DCMAKE_BUILD_TYPE=Release -DHAS_AFFILIATES=OFF -DHAS_TEST=OFF -DHAS_EXAMPLES=OFF
cmake --build .
sudo cmake --install .
popd
mkdir -p lib_test_build
pushd lib_test_build
cmake ../test/lib_test
cmake --build .
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
./lib_test --no-ui
find
popd
- name: Run lib install test
if: startsWith(matrix.config.os, 'macos')
shell: bash
run: |
mkdir -p clean_build
pushd clean_build
cmake .. -DNO_INSTALL_TEST=1 -DCMAKE_BUILD_TYPE=Release -DHAS_AFFILIATES=OFF -DHAS_TEST=OFF -DHAS_EXAMPLES=OFF
cmake --build .
sudo cmake --install .
popd
mkdir -p lib_test_build
pushd lib_test_build
cmake ../test/lib_test
cmake --build .
./lib_test --no-ui
popd
- name: Run lib install test
if: false # TODO
#if: startsWith(matrix.config.os, 'windows')
shell: bash
run: |
if [ "${{ matrix.config.cxx }}" == "cl" ]; then
while IFS= read -r line; do
if [[ $line =~ ^([a-zA-Z0-9_-]+)=(.*)$ ]]; then
var_name="${BASH_REMATCH[1]}"
var_value="${BASH_REMATCH[2]}"
export "$var_name=$var_value"
fi
done < environment_script_output.txt
fi
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
mkdir -p clean_build
pushd clean_build
mkdir -p include
mkdir -p lib
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=../clean_install -DNO_INSTALL_TEST=1 -DCMAKE_BUILD_TYPE=Release -DHAS_AFFILIATES=OFF -DHAS_TEST=OFF -DHAS_EXAMPLES=OFF -DCMAKE_INSTALL_INCLUDEDIR=include -DCMAKE_INSTALL_LIBDIR=lib
cmake --build .
cmake --install .
popd
mkdir -p lib_test_build
pushd lib_test_build
cmake ../test/lib_test -G Ninja -DCMAKE_INSTALL_PREFIX=../clean_install -DCMAKE_INSTALL_LIBDIR=lib
cmake --build .
"/c/Program\ Files/Microsoft\ Visual\ Studio/2022/Enterprise/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/dumpbin.exe" //dependents lib_test.exe
./lib_test.exe --no-ui
popd
- name: List this folder
shell: bash
run: pwd && ls -R
- name: Install Strip
run: cmake --install build --prefix install_dir --strip
- name: List this folder
shell: bash
run: ls -R
- name: Pack
working-directory: install_dir
run: cmake -E tar cJfv ../${{ matrix.config.artifact }} .
- name: Upload
uses: actions/upload-artifact@v4
with:
overwrite: true
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Release
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allowUpdates: true
- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- uses: actions/upload-artifact@v4
with:
overwrite: true
path: ./upload_url
name: upload_url
publish:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC", artifact: "Gempyre-Windows-MSVC.tar.xz",
os: ubuntu-latest
}
- {
name: "Windows Latest MinGW", artifact: "Gempyre-Windows-MinGW.tar.xz",
os: ubuntu-latest
}
- {
name: "Ubuntu Latest GCC", artifact: "Gempyre-Linux.tar.xz",
os: ubuntu-latest
}
- {
name: "macOS Latest Clang", artifact: "Gempyre-macOS.tar.xz",
os: ubuntu-latest
}
needs: release
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.config.artifact }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ matrix.config.artifact }}