-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
159 lines (148 loc) · 4.46 KB
/
.gitlab-ci.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
# Configure the pipeline stages
stages:
- build-stage
- test-stage
# Set global environment variables
variables:
HDTN_SOURCE_ROOT: "$PWD"
# Set the pipleline to run for merge request events only
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# Build HDTN with the default configuration
# Use this for unit and integrated tests
build-default:
stage: build-stage
tags:
- docker
- linux-x86
image: $CI_REGISTRY/hdtn-v4/hdtn/debian-base
script:
- mkdir -p build
- cmake -S . -B build
- make -C build/ -j8
cache:
key: build-default-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-$CI_MERGE_REQUEST_ID
paths:
- build
artifacts:
paths:
- build
# Build HDTN with C++11 only
build-cpp11:
stage: build-stage
tags:
- docker
- linux-x86
image: $CI_REGISTRY/hdtn-v4/hdtn/debian-base
script:
- mkdir -p build
- cmake -S . -B build -DHDTN_TRY_USE_CPP17:BOOL=OFF
- make -C build/ -j8
cache:
key: build-cpp11-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-$CI_MERGE_REQUEST_ID
paths:
- build
# Build HDTN with extra compile options
build-extra-options:
stage: build-stage
tags:
- docker
- linux-x86
image: $CI_REGISTRY/hdtn-v4/hdtn/debian-base
script:
- mkdir -p external
- cp -r /home/civetweb/include external/include
- mkdir -p external/lib
- cp /home/civetweb/libcivetweb.a external/lib
- mkdir -p build
- cmake -S . -B build -DUSE_WEB_INTERFACE:BOOL=OFF -DDO_STATS_LOGGING=ON -DENABLE_OPENSSL_SUPPORT=OFF
- make -C build/ -j8
cache:
key: build-without-gui-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-$CI_MERGE_REQUEST_ID
paths:
- build
build-static-analysis:
stage: build-stage
tags:
- cov-analysis
script:
- export PATH=/home/hdtn/cov-analysis-linux64-2022.6.1/bin:$PATH
- export HDTN_SOURCE_ROOT=$PWD
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- cov-build --dir idir make -j8
cache:
key: build-static-analysis-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-$CI_MERGE_REQUEST_ID
paths:
- build
artifacts:
paths:
- build
# Run unit tests and generate a test report
unit-test:
stage: test-stage
tags:
- docker
- linux-x86
image: $CI_REGISTRY/hdtn-v4/hdtn/debian-base
needs:
- build-default
dependencies:
- build-default
script:
- ./build/tests/unit_tests/unit-tests --log_format=JUNIT --log_sink=report.xml
artifacts:
when: always
paths:
- report.xml
reports:
junit: report.xml
# Run unit tests and generate a test report
integrated-test:
stage: test-stage
tags:
- docker
- linux-x86
image: $CI_REGISTRY/hdtn-v4/hdtn/debian-base
needs:
- build-default
dependencies:
- build-default
script:
- ./build/tests/integrated_tests/integrated-tests --log_format=JUNIT --log_sink=report.xml
artifacts:
when: always
paths:
- report.xml
reports:
junit: report.xml
# Static Analysis Legacy defects
static-analysis-legacy:
stage: test-stage
tags:
- cov-analysis
dependencies:
- build-static-analysis
needs:
- build-static-analysis
script:
- git fetch
- export PATH=/home/hdtn/cov-analysis-linux64-2022.6.1/bin:$PATH
- export files_to_scan=$(git diff --name-only origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | grep '\.cpp')
- if [ "$files_to_scan" != "" ]; then cov-run-desktop --dir build/idir --url $COV_BUILD_SERVER --auth-key-file /home/hdtn/ci-auth.key --stream HDTN-master --exit1-if-defects true --ignore-uncapturable-inputs true --present-in-reference true --all --enable-constraint-fpp --enable-fnptr --enable-virtual $files_to_scan; else echo "No files to scan"; fi
# Static Analysis New defects
static-analysis-new:
stage: test-stage
tags:
- cov-analysis
dependencies:
- build-static-analysis
needs:
- build-static-analysis
script:
- git fetch
- export PATH=/home/hdtn/cov-analysis-linux64-2022.6.1/bin:$PATH
- export files_to_scan=$(git diff --name-only origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | grep '\.cpp')
- if [ "$files_to_scan" != "" ]; then cov-run-desktop --dir build/idir --url $COV_BUILD_SERVER --auth-key-file /home/hdtn/ci-auth.key --stream HDTN-master --exit1-if-defects true --ignore-uncapturable-inputs true --present-in-reference false --all --enable-constraint-fpp --enable-fnptr --enable-virtual $files_to_scan; else echo "No files to scan"; fi