-
Notifications
You must be signed in to change notification settings - Fork 29
229 lines (220 loc) · 8.35 KB
/
build.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
# ------------------------------------------------------------------------------------------------ #
# This file is part of CosmoScout VR #
# ------------------------------------------------------------------------------------------------ #
# SPDX-FileCopyrightText: German Aerospace Center (DLR) <cosmoscout@dlr.de>
# SPDX-License-Identifier: MIT
name: Build
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
clang_format:
name: Check Clang-Format
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout Submodules
run: git submodule update --init plugins
- name: Download Clang-Format
run: |
sudo apt-get update -y
sudo apt-get install -y clang-format-11
- name: Run Clang-Format
run: ./tools/clang-format.sh
- name: Compare Results
run: |
DIFF=$(git diff)
if [ ! -z "$DIFF" ]; then echo $DIFF && exit 1; fi
reuse:
name: Check Compliance with REUSE Specification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v4
comment_percentage:
name: Check Comment Percentage
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request'
steps:
- name: Checkout Current Repository
uses: actions/checkout@v4
with:
path: current
ref: ${{ github.ref }}
- name: Checkout Base Repository
uses: actions/checkout@v4
with:
path: base
ref: ${{ github.base_ref }}
- name: Checkout Current Submodules
run: cd $GITHUB_WORKSPACE/current && git submodule update --init plugins
- name: Checkout Base Submodules
run: cd $GITHUB_WORKSPACE/base && git submodule update --init plugins
- name: Download Cloc
run: |
sudo apt-get update -y
sudo apt-get install -y cloc
- name: Run Cloc
run: |
BASE="$(base/tools/cloc.sh --percentage-only)"
CURRENT="$(current/tools/cloc.sh --percentage-only)"
echo "Percentage of Comments in Base Repository: $BASE"
echo "Percentage of Comments after Merge: $CURRENT"
if (( $(echo "$BASE > $CURRENT" |bc -l) ))
then
awk -v a=$CURRENT -v b=$BASE 'BEGIN {printf "Percentage decreased! (%3.4f%)\n", (a-b)}'
exit 1
else
awk -v a=$CURRENT -v b=$BASE 'BEGIN {printf "Percentage increased! (%3.4f%)\n", (a-b)}'
fi
build_linux_gcc:
name: Linux GCC 9.3.0
runs-on: ubuntu-20.04
if: >
github.event_name == 'pull_request' ||
( contains(github.ref, 'main') && !contains(github.event.head_commit.message, '[no-ci]') ) ||
contains(github.event.head_commit.message, '[run-ci]')
env:
COSMOSCOUT_USE_PCH: false
COSMOSCOUT_USE_UNITY_BUILD: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Cache Object Files
uses: hendrikmuhs/ccache-action@v1.2.5
with:
key: gcc
- name: Download Dependencies
run: |
sudo apt-get update -q
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libx11-dev
sudo apt-get install libxi-dev libgconf-2-4 libboost-all-dev lcov xvfb
- name: Build Externals
run: >
./make_externals.sh -G "Unix Makefiles"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
- name: Build CosmoScout VR
run: |
cmake --preset linux-make-release-config -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCOSMOSCOUT_COVERAGE_INFO=On
cmake --build --preset linux-make-release-build
- name: Run Tests
run: |
./install/linux-Release/bin/run_tests.sh
- name: Run Graphical Tests
run: |
./install/linux-Release/bin/run_graphical_tests.sh
- name: Upload Results of Failed Test
uses: actions/upload-artifact@v4
if: failure()
with:
name: graphical-test-results-gcc
path: install/linux-Release/bin/test
- name: Calculate Test Coverage
run: |
./tools/lcov.sh
- name: Upload Coverage Info
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./build/linux-Release/coverage.info
build_linux_clang:
name: Linux Clang 11.0
runs-on: ubuntu-20.04
if: >
github.event_name == 'pull_request' ||
( contains(github.ref, 'main') && !contains(github.event.head_commit.message, '[no-ci]') ) ||
contains(github.event.head_commit.message, '[run-ci]')
env:
CC: clang-11
CXX: clang++-11
COSMOSCOUT_USE_PCH: false
COSMOSCOUT_USE_UNITY_BUILD: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Cache Object Files
uses: hendrikmuhs/ccache-action@v1.2.5
with:
key: clang
- name: Download Dependencies
run: |
sudo apt-get update -q
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libx11-dev
sudo apt-get install libxi-dev libgconf-2-4 libboost-all-dev
- name: Build Externals
run: >
./make_externals.sh -G "Unix Makefiles"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
- name: Build CosmoScout VR
run: |
cmake --preset linux-make-release-config -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cmake --build --preset linux-make-release-build
- name: Run Tests
run: |
./install/linux-Release/bin/run_tests.sh
- name: Run Graphical Tests
run: |
./install/linux-Release/bin/run_graphical_tests.sh
- name: Upload Results of Failed Test
uses: actions/upload-artifact@v4
if: failure()
with:
name: graphical-test-results-clang
path: install/linux-Release/bin/test
build_windows:
name: Windows MSVC 19.25
runs-on: windows-2019
if: >
github.event_name == 'pull_request' ||
( contains(github.ref, 'main') && !contains(github.event.head_commit.message, '[no-ci]') ) ||
contains(github.event.head_commit.message, '[run-ci]')
env:
BOOST_ROOT_1_72_0: C:\hostedtoolcache\windows\Boost\1.72.0\x86_64
COSMOSCOUT_USE_PCH: true
COSMOSCOUT_USE_UNITY_BUILD: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Cache Object Files
uses: hendrikmuhs/ccache-action@v1.2.5
with:
key: msvc
- name: Setup CMD
uses: ilammy/msvc-dev-cmd@v1
- name: Download Dependencies
run: |
# From https://github.com/actions/virtual-environments/issues/2667
$url = "https://github.com/actions/boost-versions/releases/download/1.72.0-20200608.4/boost-1.72.0-win32-msvc14.2-x86_64.tar.gz"
(New-Object System.Net.WebClient).DownloadFile($url, "$env:TEMP\boost.tar.gz")
7z.exe x "$env:TEMP\boost.tar.gz" -o"$env:TEMP\boostArchive" -y | Out-Null
7z.exe x "$env:TEMP\boostArchive" -o"$env:TEMP\boost" -y | Out-Null
Push-Location -Path "$env:TEMP\boost"
Invoke-Expression .\setup.ps1
choco install ninja
- name: Build Externals
shell: cmd
run: >
make_externals.bat -GNinja -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
- name: Build CosmoScout VR
shell: cmd
run: |
cmake --preset windows-ninja-release-config -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=%BOOST_ROOT_1_72_0%
cmake --build --preset windows-ninja-release-build
- name: Run Tests
shell: cmd
run: |
SET PATH=%BOOST_ROOT_1_72_0%\\lib;%PATH%
install\\windows-Release\\bin\\run_tests.bat