-
Notifications
You must be signed in to change notification settings - Fork 21
327 lines (318 loc) · 12.2 KB
/
per_commit.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
name: "CI"
on: [push]
jobs:
Ubuntu:
runs-on: ubuntu-latest
outputs:
cache_hit_rate: ${{ steps.ccache_results.outputs.cache_hit_rate }}
steps:
- uses: actions/checkout@v1
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get -y install apt-utils
sudo apt-get -y install git gcc g++ cmake python make ninja-build
#sudo apt-get -y install qt5-default
#sudo apt-get -y install gdb valgrind
#sudo apt-get -y install mpi-default-dev mpi-default-bin # mpi tests with 3 nodes fail on the CI for some unknown reason
sudo apt-get -y install tcpdump libgsl-dev libxml2-dev
sudo apt-get -y install curl unzip tar
sudo apt-get -y install ccache
- name: Get timestamp
id: time
run: python3 -c "from datetime import datetime; print('::set-output name=time::'+datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))"
- name: Restore ccache
id: ccache
uses: actions/[email protected]
with:
path: .ccache
key: ubuntu-ci-${{steps.time.outputs.time}}
restore-keys: ubuntu-ci-
- name: Setup ccache
run: |
ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache"
ccache --set-config=max_size=400M
ccache --set-config=compression=true
ccache -z
- name: Configure CMake
run: |
mkdir cmake-cache
cd cmake-cache
cmake -DCMAKE_BUILD_TYPE=minsizerel -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -G"Ninja" ..
- name: Build ns-3
run: |
cd cmake-cache
ninja
- name: Print ccache statistics
id: ccache_results
run: |
ccache -s
python3 -c "import re; print('::set-output name=cache_hit_rate::'+re.findall('.* (.*) %', '`ccache -s | grep "cache hit rate"`')[0])"
- name: Run tests and examples
if: steps.ccache_results.outputs.cache_hit_rate != '100.00'
run: python3 test.py --nowaf
CodeQL:
runs-on: ubuntu-latest
needs: Ubuntu
if: needs.Ubuntu.outputs.cache_hit_rate != '100.00'
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: 'cpp'
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get -y install apt-utils
sudo apt-get -y install git gcc g++ cmake python make ninja-build
#sudo apt-get -y install qt5-default
#sudo apt-get -y install gdb valgrind
#sudo apt-get -y install mpi-default-dev mpi-default-bin # mpi tests with 3 nodes fail on the CI for some unknown reason
sudo apt-get -y install tcpdump libgsl-dev libxml2-dev
sudo apt-get -y install curl unzip tar
sudo apt-get -y install ccache
- name: Get timestamp
id: time
run: python3 -c "from datetime import datetime; print('::set-output name=time::'+datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))"
- name: Restore ccache
id: ccache
uses: actions/[email protected]
with:
path: .ccache
key: ubuntu-ci-${{steps.time.outputs.time}}
restore-keys: ubuntu-ci-
- name: Setup ccache
run: |
ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache"
ccache --set-config=max_size=400M
ccache --set-config=compression=true
ccache -z
- name: Configure CMake
run: |
mkdir cmake-cache
cd cmake-cache
cmake -DCMAKE_BUILD_TYPE=minsizerel -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -G"Ninja" ..
- name: Build ns-3
run: |
cd cmake-cache
ninja
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Codecov:
runs-on: ubuntu-latest
needs: Ubuntu
if: needs.Ubuntu.outputs.cache_hit_rate != '100.00'
steps:
- uses: actions/checkout@v1
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get -y install apt-utils
sudo apt-get -y install git gcc g++ cmake python3 make ninja-build
#sudo apt-get -y install qt5-default
#sudo apt-get -y install gdb valgrind
sudo apt-get -y install tcpdump libgsl-dev libxml2-dev
#sudo apt-get -y install mpi-default-dev mpi-default-bin
sudo apt-get -y install curl unzip tar
sudo apt-get -y install ccache
sudo apt-get -y install lcov
- name: Get timestamp
id: time
run: python3 -c "from datetime import datetime; print('::set-output name=time::'+datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))"
- name: Restore ccache
id: ccache
uses: actions/[email protected]
with:
path: .ccache
key: ubuntu-coverage-${{steps.time.outputs.time}}
restore-keys: ubuntu-coverage-
- name: Setup ccache
run: |
ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache"
ccache --set-config=max_size=400M
ccache --set-config=compression=true
ccache -z
- name: Configure CMake
run: |
mkdir cmake-cache
cd cmake-cache
cmake -DCMAKE_BUILD_TYPE=relwithdebinfo -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -DNS3_COVERAGE=ON -G"Ninja" ..
- name: Build ns-3
run: |
cd cmake-cache
cmake --build . -j3
- name: Print ccache statistics
id: ccache_results
run: |
ccache -s
python3 -c "import re; print('::set-output name=cache_hit_rate::'+re.findall('.* (.*) %', '`ccache -s | grep "cache hit rate"`')[0])"
- name: Generate coverage data and submit to codecov.io
if: steps.ccache_results.outputs.cache_hit_rate != '100.00'
run: |
cd cmake-cache
ninja coverage_gcc
cd ../build/coverage
bash <(curl -s https://codecov.io/bash) -f ns3.info || echo "Codecov did not collect coverage reports"
#Codacy: # Refuses to work... Whatever.
# runs-on: ubuntu-latest
# needs: Ubuntu
# if: needs.Ubuntu.outputs.cache_hit_rate != '100.00'
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Run Codacy Analysis CLI
# uses: codacy/codacy-analysis-cli-action@master
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# upload: true
# verbose: true
#
# # Adjust severity of non-security issues
# # gh-code-scanning-compat: true
# # Force 0 exit code to allow SARIF file generation
# # This will handover control about PR rejection to the GitHub side
# max-allowed-issues: 2147483647
Windows_MinGW:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v1
# Manual setup
#- name: Install msys2/mingw64
# #steps from https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml
# run: |
# git clone https://github.com/msys2/msys2-ci-base.git D:\msys64 # they removed this repo :(
# D:\msys64\usr\bin\rm -rf D:\msys64\.git
# set PATH=D:\msys64\usr\bin;%WINDIR%;%WINDIR%\System32
# D:\msys64\usr\bin\pacman --noconfirm -Syyuu
# set PATH=D:\msys64\usr\bin;%WINDIR%;%WINDIR%\System32
# D:\msys64\usr\bin\pacman --noconfirm --needed -S git base-devel
# D:\msys64\usr\bin\pacman --noconfirm -Scc
# shell: cmd
- uses: msys2/setup-msys2@v2
- name: Install required msys2/mingw64 packages
run: |
pacman -S --noconfirm unzip
pacman -S --noconfirm tar
pacman -S --noconfirm mingw-w64-x86_64-curl
pacman -S --noconfirm mingw-w64-x86_64-binutils
pacman -S --noconfirm mingw-w64-x86_64-cmake
pacman -S --noconfirm mingw-w64-x86_64-gcc
pacman -S --noconfirm mingw-w64-x86_64-ninja
pacman -S --noconfirm mingw-w64-x86_64-python
pacman -S --noconfirm mingw-w64-x86_64-ccache
pacman -S --noconfirm mingw-w64-x86_64-gsl
pacman -S --noconfirm mingw-w64-x86_64-libxml2
pacman --noconfirm -Scc
- name: Get timestamp
id: time
run: python -c "from datetime import datetime; print('::set-output name=time::'+datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))"
- name: Restore ccache
id: ccache
uses: actions/[email protected]
with:
path: .ccache
key: msys2-${{steps.time.outputs.time}}
restore-keys: msys2-
- name: Setup ccache
run: |
ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache"
ccache --set-config=max_size=400M
ccache --set-config=compression=true
ccache -z
- name: Configure CMake
run: |
mkdir cmake-cache
cd cmake-cache
cmake -DCMAKE_BUILD_TYPE=minsizerel -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -G"Ninja" ..
- name: Build ns-3
run: |
cd cmake-cache
ninja
- name: Print ccache statistics
id: ccache_results
run: |
ccache -s
python -c "import re; print('::set-output name=cache_hit_rate::'+re.findall('.* (.*) %', '`ccache -s | grep "cache hit rate"`')[0])"
- name: Run tests and examples
continue-on-error: true
if: steps.ccache_results.outputs.cache_hit_rate != '100.00'
run: python test.py --nowaf
Mac_OS_X:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install required packages
run: |
brew install ninja cmake gcc@9 ccache libxml2 gsl open-mpi #qt5
- name: Get timestamp
id: time
run: python3 -c "from datetime import datetime; print('::set-output name=time::'+datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))"
- name: Restore ccache
id: ccache
uses: actions/[email protected]
with:
path: .ccache
key: osx_brew-ci-${{steps.time.outputs.time}}
restore-keys: osx_brew-ci-
- name: Setup ccache
run: |
export PATH=/usr/local/bin:$PATH #:/usr/local/opt/qt/bin
ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache"
ccache --set-config=max_size=400M
ccache --set-config=compression=true
ccache -z
- name: Configure CMake
run: |
export PATH=/usr/local/bin:$PATH #:/usr/local/opt/qt/bin
export CXX=g++-9
export CC=gcc-9
mkdir cmake-cache
cd cmake-cache
cmake -DCMAKE_BUILD_TYPE=minsizerel -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -G"Ninja" ..
- name: Build ns-3
run: |
export PATH="$PATH" #:/usr/local/opt/qt/bin
cd cmake-cache
ninja
- name: Print ccache statistics
id: ccache_results
run: |
ccache -s
python3 -c "import re; print('::set-output name=cache_hit_rate::'+re.findall('.* (.*) %', '`ccache -s | grep "cache hit rate"`')[0])"
- name: Run tests and examples
if: steps.ccache_results.outputs.cache_hit_rate != '100.00'
run: python3 test.py --nowaf
Windows_Visual_Studio: # disable until remaining issues are not fixed and find a way to cache compilation artifacts
runs-on: windows-latest
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
- name: Configure CMake
run: |
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
mkdir cmake-cache
cd cmake-cache
cmake -DCMAKE_BUILD_TYPE=minsizerel -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -G"Visual Studio 16 2019" -A x64 -T ClangCL ..
- name: Build ns-3
continue-on-error: true
run: |
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
cd cmake-cache
cmake --build . --parallel 4
- name: Run tests and examples
continue-on-error: true
timeout-minutes: 60
run: |
set PATH=%CD%\build;%PATH%
python .\test.py --nowaf