-
Notifications
You must be signed in to change notification settings - Fork 7
321 lines (293 loc) · 12.4 KB
/
libelement.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
name: libelement
on: [push]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "ubuntu-gcc",
os: ubuntu-latest,
build_type: "Release",
cc: "gcc",
cxx: "g++",
generators: "Ninja",
}
- {
name: "ubuntu-clang",
os: ubuntu-latest,
artifact: "ubuntu-clang.7z",
build_type: "Release",
cc: "clang",
cxx: "clang++",
generators: "Ninja",
}
- {
name: "windows-msvc-vs2022",
os: windows-2022,
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
generators: "Visual Studio 17 2022"
}
- {
name: "macos-clang",
os: macos-latest,
build_type: "Release",
cc: "clang",
cxx: "clang++",
generators: "Ninja"
}
steps:
- uses: actions/checkout@v2
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
cmake --version
- name: Install dependencies on ubuntu
if: startsWith(matrix.config.name, 'ubuntu')
run: |
sudo apt-get install ninja-build
ninja --version
cmake --version
gcc --version
- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install p7zip cmake ninja
ninja --version
cmake --version
- name: Configure
shell: bash
run: |
mkdir -p libelement/build
export CC=${{ matrix.config.CC }}
export CXX=${{ matrix.config.CXX }}
cmake \
-S libelement \
-B libelement/build \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}"
- name: Build
shell: bash
run: cmake --build libelement/build --config ${{ matrix.config.build_type }}
- name: Upload Build Developer Logs
uses: actions/upload-artifact@v2
with:
name: '${{ matrix.config.name }}-build_dev_logs'
path: |
**/build/**/*.txt
**/build/**/*.gcda
**/build/**/*.gcno
**/build/**/*codecov*
**/build/**/*.xml
**/build/**/*.cmake
**/build/**/*.log
**/build/**/*.json
**/build/**/*.gcov
**/build/**/*.info
**/build/**/.*
!**/build/_deps
retention-days: 1
# Check source code formatting
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
# If your submodules are configured to use SSH instead of HTTPS please uncomment the following line
git config --global url."https://github.com/".insteadOf "[email protected]:"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Install dependencies
run: |
sudo apt update
sudo apt install clang-format-9
- name: Run analysis
run: |
mkdir -p libelement/build
cmake \
-S libelement \
-B libelement/build \
..
# Run clang-format to see if code matches our style guide, clang-format target can be used to apply changes
cmake --build libelement/build --target element_clang_check
#todo: libelement tests are old and not really working, we mostly rely on laboratory
#
# run-libelement-tests:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Checkout submodules
# shell: bash
# run: |
# # If your submodules are configured to use SSH instead of HTTPS please uncomment the following line
# git config --global url."https://github.com/".insteadOf "[email protected]:"
# auth_header="$(git config --local --get http.https://github.com/.extraheader)"
# git submodule sync --recursive
# git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# - name: Run tests
# run: |
# export CC=gcc-9
# export CXX=g++-9
# cd libelement
# mkdir build
# cd build
# cmake -DBUILD_TESTING=ON ..
# cmake --build .
# make test
# - name: Upload test results
# if: failure()
# uses: actions/[email protected]
# with:
# name: libelement Test App Results
# path: libelement/build/libemelement_test_app_details.xml
#todo: this works but we don't have a way of disabling known failing tests, so until libelement passes all tests, it's not useful to run on CI
# we need to run the laboratory test suite manually for all MR's, or figure out something nicer
#
# run-laboratory-tests-ubuntu:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Checkout submodules
# shell: bash
# run: |
# # If your submodules are configured to use SSH instead of HTTPS please uncomment the following line
# git config --global url."https://github.com/".insteadOf "[email protected]:"
# auth_header="$(git config --local --get http.https://github.com/.extraheader)"
# git submodule sync --recursive
# git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# - name: Run tests
# run: |
# cd Laboratory
# export CC=gcc-9
# export CXX=g++-9
# dotnet test --test-adapter-path:. --logger:trx -s "libelement_cli_unix_ci_debug.runsettings"
# - name: Uploaded test results on fail
# if: failure()
# uses: actions/[email protected]
# with:
# name: libelement Laboratory Results
# path: Laboratory/TestResults
#todo: same as above
#
# run-laboratory-tests-macos:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v2
# - name: Checkout submodules
# shell: bash
# run: |
# # If your submodules are configured to use SSH instead of HTTPS please uncomment the following line
# git config --global url."https://github.com/".insteadOf "[email protected]:"
# auth_header="$(git config --local --get http.https://github.com/.extraheader)"
# git submodule sync --recursive
# git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# - name: Run tests
# run: |
# cd Laboratory
# dotnet test --test-adapter-path:. --logger:trx -s "libelement_cli_unix_ci_debug.runsettings"
# - name: Uploaded test results on fail
# if: failure()
# uses: actions/[email protected]
# with:
# name: libelement Laboratory Results
# path: Laboratory/TestResults
#todo: this fails due to using GCC8 when it's not installed
# there might be other issues, like needing a specific combination of LCOV/GCOV/GCC versions
# fix #oneday
#
# code-coverage:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Checkout submodules
# shell: bash
# run: |
# # If your submodules are configured to use SSH instead of HTTPS please uncomment the following line
# git config --global url."https://github.com/".insteadOf "[email protected]:"
# auth_header="$(git config --local --get http.https://github.com/.extraheader)"
# git submodule sync --recursive
# git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# - name: Install dependencies
# run: |
# #download lcov, used for outputting basic summary (and may be used in the future)
# mkdir lcov
# wget -c https://github.com/linux-test-project/lcov/releases/download/v1.14/lcov-1.14.tar.gz -O - | tar -xz -C lcov/
# cd lcov/lcov-1.14
# sudo make install
# cd ../..
# #install gcovr, used to generate the sonarqube coverage
# pip install gcovr
# python -m gcovr -v
# #download sonarqube code scanner
# mkdir codescanner
# cd codescanner
# sudo wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.4.0.2170-linux.zip
# sudo unzip sonar-scanner-cli-4.4.0.2170-linux.zip
# sudo rm sonar-scanner-cli-4.4.0.2170-linux.zip
# sudo chmod +x sonar-scanner-4.4.0.2170-linux/bin/sonar-scanner
# cd ..
# - name: Run tests with code coverage
# env:
# SONARQUBE_URL: ${{ secrets.SONARQUBE_URL }}
# SONARQUBE_LIBELEMENT: ${{ secrets.SONARQUBE_LIBELEMENT }}
# run: |
# #specify compiler version for cmake
# export CC=gcc-8
# export CXX=g++-8
# #specify gcov version to match compiler version
# sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-8 90
# sudo ln -sf /usr/bin/gcov-8 /usr/bin/gcov
# # ---- libelement Test App Coverage ----
# cd libelement
# mkdir build
# cd build
# cmake -DELEMENT_BUILD_TESTING=ON -DELEMENT_CODE_COVERAGE=ON ..
# set +e
# cmake --build . --target element_test_coverage
# set -e
# cd ../..
# # ----- Laboratory Tests Coverage ------
# cd Laboratory
# #run laboratory tests, without failing the build on error
# set +e
# dotnet test -v q --test-adapter-path:. --logger:trx -s "libelement_cli_unix_ci_debug_codecoverage.runsettings"
# set -e
# cd ../libelement.CLI/build
# #run lcov, gathering coverage info and outputting a basic summary
# lcov --capture --directory . --output-file coverage.info
# lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' --output-file coverage.info
# lcov --list coverage.info
# # ----- Sonarqube coverage generation ------
# #run gcvor using python as it's not in PATH. root is the entire element repo. exclude using regex, libraries and paths that don't matter.
# #note: we have to exclude c files as sonarqube doesn't like them
# #we output the coverage file at the root of the repository
# python -m gcovr -r "../../" -e ".*dependencies\/.*" -e ".*_deps\/.*" -e ".*build\/.*" -e ".*\.c$" --sonarqube ../../coverage.xml -s
# cd ../..
# #run the code scanner
# #sources include libelement and libelement.CLI (the CLI is what we run to generate the coverage, useful to see coverage for it as well)
# #the entire repo is the project. all of these path settings are required for sonarqube and gcovr to understand the same relative paths
# #if paths break, look at contents of coverage file for the paths used
# #exclude looking at dependencies and other unrelated things, sonarqubes custom wildcard formatting
# ./codescanner/sonar-scanner-4.4.0.2170-linux/bin/sonar-scanner \
# -Dsonar.login=$SONARQUBE_LIBELEMENT \
# -Dsonar.host.url=$SONARQUBE_URL \
# -Dsonar.projectKey=libelement \
# -Dsonar.sources=libelement,libelement.CLI \
# -Dsonar.projectName="libelement" \
# -Dsonar.coverageReportPaths="coverage.xml" \
# -Dsonar.projectBaseDir="." \
# -Dsonar.exclusions=**/dependencies/**/*,**/_deps/**/*,**/build/**/* \
# -Dsonar.coverage.exclusions=**/dependencies/**/*,**/_deps/**/*,**/build/**/*