summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: af15b136e8a06262e0a43198d010918bb10066a7 (plain)
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
variables:
  GIT_STRATEGY: "clone"
  BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/
  BUILD_IMAGE_X86_64_ROCKY8: "git.mesalab.cn:7443/mesa_platform/build-env:rocky8-for-sapp"
  BUILD_IMAGE_AARCH64_ROCKY9: "git.mesalab.cn:7443/mesa_platform/build-env:rocky9-aarch64"
  INSTALL_DEPENDENCY_LIBRARY: 
    framework_env libcjson-devel  libbreakpad_mini-devel libuuid-devel
    libMESA_htable-devel libMESA_prof_load-devel libMESA_handle_logger-devel
    libMESA_field_stat2-devel libfieldstat3-devel libfieldstat4-devel
    hasp-tools 
  MRZCPD: mrzcpd-corei7 
  SYMBOL_TARGET: sapp
  TEST_NAME: gtest_sapp_v4
  INSTALL_PREFIX: "/opt/tsg/sapp/"

stages:
- cppcheck
- build
- test
- envelope
- upload

###############################################################################
# cppcheck 
###############################################################################
.cppcheck_script:
  variables:    
    BUILD_TYPE: Debug
  stage: cppcheck
  script:
    - cd build; cmake3 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
    - >
      cppcheck --project=compile_commands.json 
      --enable=all 
      --error-exitcode=1 
      --suppress=unusedFunction 
      --suppress=missingInclude 
      --suppress=uselessAssignmentPtrArg
      --suppress=unmatchedSuppression
      --suppress=variableScope
      --suppress=unreadVariable
      --suppress=cstyleCast
      --suppress=memleakOnRealloc
      --suppress=constParameter
      --suppress=uselessAssignmentArg
      --suppress=uninitvar
      --suppress=unusedStructMember
      --suppress=preprocessorErrorDirective
      --suppress=syntaxError
      --suppress=*:${CI_PROJECT_DIR}/src/support/ap_bloom/deps/*

run_cppcheck_for_x86_64_rocky8:
  extends: .cppcheck_script
  image: $BUILD_IMAGE_X86_64_ROCKY8
  tags:
    - tsg-os-builder-el8  

run_cppcheck_for_aarch64_rocky9:
  extends: .cppcheck_script
  image: $BUILD_IMAGE_AARCH64_ROCKY9
  tags:
    - tsg-os-builder-aarch64  
###############################################################################
# build 
###############################################################################

.everything_before_build_script: &everything_before_build_script
    - mkdir -p $BUILD_PADDING_PREFIX/$CI_PROJECT_NAMESPACE/
    - ln -s $CI_PROJECT_DIR $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
    - cd $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
    - yum makecache --disablerepo="*" --enablerepo="framework,platform"
    - yum install -y $INSTALL_DEPENDENCY_LIBRARY $MRZCPD
    - source /etc/profile.d/framework.sh; source /etc/profile.d/mrzcpd.sh

.build_before_script:
  before_script: *everything_before_build_script
  script:
    - mkdir build || true
    - cd build
    - >
      cmake3 -DCMAKE_BUILD_TYPE=$BUILD_TYPE 
      -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX 
      -DBUILD_TEST=$BUILD_TEST 
      -DCAPTURE_MODE=MARSIO 
      -DPLATFORM_MODE=INLINE
      -DMEM_POOL=$MEM_POOL 
      -DHASP_ENABLED=$HASP_ENABLED 
      -DFEATURE_ID=$FEATURE_ID 
      -DHASP_INTERNAL_S=$HASP_INTERNAL_S 
      -DASAN_OPTION=$ASAN_OPTION ..
    - make -j4 VERBOSE=1
    - make package
  variables:    
    BUILD_TEST: "ON"
    BUILD_TYPE: Debug
  stage: build    

.build_for_x86_64_rocky8:
  image: $BUILD_IMAGE_X86_64_ROCKY8
  extends: .build_before_script
  tags:
    - tsg-os-builder-el8

develop_build_for_x86_64_rocky8:
  extends: .build_for_x86_64_rocky8
  variables:
    BUILD_TYPE: RelWithDebInfo
  artifacts:
    name: "$SYMBOL_TARGET-$CI_COMMIT_REF_NAME-debug"
    paths:
      - build/*
  except:
    - tags

release_build_debug_for_x86_64_rocky8:
  extends: .build_for_x86_64_rocky8
  variables:
    BUILD_TYPE: Debug
    ASAN_OPTION: "ADDRESS"
  artifacts:
    name: "$SYMBOL_TARGET-$CI_COMMIT_REF_NAME-release"
    paths:
      - build/*
  only:
    - tags

release_build_for_x86_64_rocky8:
  extends: .build_for_x86_64_rocky8
  variables:
    BUILD_TYPE: RelWithDebInfo
    MEM_POOL: JEMALLOC_STATIC  
  artifacts:
    name: "$SYMBOL_TARGET-$CI_COMMIT_REF_NAME-release"
    paths:
      - build/*
  only:
    - tags   

.build_for_aarch64_rocky9:
  image: $BUILD_IMAGE_AARCH64_ROCKY9
  extends: .build_before_script
  variables:    
    MRZCPD: mrzcpd 
  tags:
    - tsg-os-builder-aarch64

develop_build_for_aarch64_rocky9:
  extends: .build_for_aarch64_rocky9
  variables:
    BUILD_TYPE: RelWithDebInfo
  artifacts:
    name: "$SYMBOL_TARGET-$CI_COMMIT_REF_NAME-debug"
    paths:
      - build/*
  except:
    - tags

release_build_debug_for_aarch64_rocky9:
  extends: .build_for_aarch64_rocky9
  variables:
    BUILD_TYPE: Debug
    ASAN_OPTION: "ADDRESS"
  artifacts:
    name: "$SYMBOL_TARGET-$CI_COMMIT_REF_NAME-release"
    paths:
      - build/*
  only:
    - tags

release_build_for_aarch64_rocky9:
  extends: .build_for_aarch64_rocky9
  variables:
    BUILD_TYPE: RelWithDebInfo
    MEM_POOL: JEMALLOC_STATIC  
  artifacts:
    name: "$SYMBOL_TARGET-$CI_COMMIT_REF_NAME-release"
    paths:
      - build/*
  only:
    - tags   
###############################################################################
# envelope 
###############################################################################
.define_before_envelope_x86_64_rocky8:
  stage: envelope
  extends: .build_for_x86_64_rocky8
  variables:
    BUILD_TEST : "OFF"
    BUILD_TYPE: RelWithDebInfo
    MEM_POOL: JEMALLOC_STATIC  
    HASP_ENABLED: "ON"
    FEATURE_ID: 100
    HASP_INTERNAL_S: 3600
  only:
    - tags

envelope_rpm_for_x86_64_rocky8:
  extends: .define_before_envelope_x86_64_rocky8
  image: $BUILD_IMAGE_X86_64_ROCKY8
  artifacts:
    name: "$SYMBOL_TARGET-pr-$CI_COMMIT_REF_NAME-release"
    paths:
      - build/*-pr-*.rpm
  dependencies:
    - release_build_for_x86_64_rocky8

.define_before_envelope_aarch64_rocky9:
  stage: envelope
  extends: .build_for_aarch64_rocky9
  variables:
    BUILD_TEST : "OFF"
    BUILD_TYPE: RelWithDebInfo
    MEM_POOL: JEMALLOC_STATIC  
    HASP_ENABLED: "ON"
    FEATURE_ID: 100
    HASP_INTERNAL_S: 3600
  only:
    - tags

envelope_rpm_for_aarch64_rocky9:
  extends: .define_before_envelope_aarch64_rocky9
  image: $BUILD_IMAGE_AARCH64_ROCKY9
  artifacts:
    name: "$SYMBOL_TARGET-pr-$CI_COMMIT_REF_NAME-release"
    paths:
      - build/*-pr-*.rpm
  dependencies:
    - release_build_for_aarch64_rocky9
###############################################################################
# test 
###############################################################################

.setup_test_env_for_x86_64_rocky8:
  stage: test
  image: $BUILD_IMAGE_X86_64_ROCKY8
  allow_failure: false
  before_script:
    - *everything_before_build_script
    - ls -l /opt/MESA/lib && echo "/opt/MESA/lib" >> /etc/ld.so.conf
    - ldconfig && sysctl -w net.ipv6.conf.all.disable_ipv6=0 && ifconfig && ulimit -c unlimited
    - ip neigh show && ip -6 neigh show
    - cd build; ctest3; pwd 
    - cd testing/ && ldd $TEST_NAME
  dependencies:
    - develop_build_for_x86_64_rocky8
    - release_build_for_x86_64_rocky8
  tags:
    - tsg-os-builder-el8    


benchmark_test_for_x86_64_rocky8:
  extends: .setup_test_env_for_x86_64_rocky8
  script:
#run module v2.0 with death test
    - ./$TEST_NAME -s -f control.*
    - ./$TEST_NAME -s -f fake_marsio.*
#run module v3.0
    - ./$TEST_NAME -s -f benchmark_drop.*
    - ./$TEST_NAME -s -f benchmark_forward.*
    - ./$TEST_NAME -s -f benchmark_inject.tcp*
    - ./$TEST_NAME -s -f benchmark_inject.inline_same_dir
    - ./$TEST_NAME -s -f benchmark_inject.inline_reverse_dir

inline_test_for_x86_64_rocky8:
  extends: .setup_test_env_for_x86_64_rocky8
  script:
#run module v2.0 with death test
    - ./$TEST_NAME -s -f inline_mode.*
#    - ./$TEST_NAME -s -f transparent.*

basic_test_for_x86_64_rocky8:
  extends: .setup_test_env_for_x86_64_rocky8
  script:
#run module v2.0 immediately
    - ./$TEST_NAME -s -f ipv4.*
    - ./$TEST_NAME -s -f ipv6.*
    - ./$TEST_NAME -s -f udp.*
    - ./$TEST_NAME -s -f appstate.*
    - ./$TEST_NAME -s -f timer.*
    - ./$TEST_NAME -s -f proxy.*
    - ./$TEST_NAME -s -f asymmetric.*
    - ./$TEST_NAME -s -f pkt_dump.*
    - ./$TEST_NAME -s -f project.*
    - ./$TEST_NAME -s -f stream_bridge.*
    - ./$TEST_NAME -s -f tunnel.*
    - ./$TEST_NAME -s -f plug_ctrl.*
    - ./$TEST_NAME -s -f jump_layer.*
    - ./$TEST_NAME -s -f hybrid.*
#    - ./$TEST_NAME -s -f inject.*
    - ./$TEST_NAME -s -f offload.*
    - ./$TEST_NAME -s -f tcp.*
    - ./$TEST_NAME -s -f tcpall.*

.setup_test_env_for_aarch64_rocky9:
  stage: test
  image: $BUILD_IMAGE_AARCH64_ROCKY9
  allow_failure: false
  variables:    
    MRZCPD: mrzcpd
  before_script:
    - *everything_before_build_script
    - ls -l /opt/MESA/lib && echo "/opt/MESA/lib" >> /etc/ld.so.conf
    - ldconfig && sysctl -w net.ipv6.conf.all.disable_ipv6=0 && ifconfig && ulimit -c unlimited
    - ip neigh show && ip -6 neigh show
    - cd build; ctest3; pwd 
    - cd testing/ && ldd $TEST_NAME
  dependencies:
    - develop_build_for_aarch64_rocky9
    - release_build_for_aarch64_rocky9
  tags:
    - tsg-os-builder-aarch64    


benchmark_test_for_aarch64_rocky9:
  extends: .setup_test_env_for_aarch64_rocky9
  script:
#run module v2.0 with death test
    - ./$TEST_NAME -s -f control.*
    - ./$TEST_NAME -s -f fake_marsio.*
#run module v3.0
    - ./$TEST_NAME -s -f benchmark_drop.*
    - ./$TEST_NAME -s -f benchmark_forward.*
    - ./$TEST_NAME -s -f benchmark_inject.tcp*
    - ./$TEST_NAME -s -f benchmark_inject.inline_same_dir
    - ./$TEST_NAME -s -f benchmark_inject.inline_reverse_dir

inline_test_for_aarch64_rocky9:
  extends: .setup_test_env_for_aarch64_rocky9
  script:
#run module v2.0 with death test
    - ./$TEST_NAME -s -f inline_mode.*
#    - ./$TEST_NAME -s -f transparent.*

basic_test_for_aarch64_rocky9:
  extends: .setup_test_env_for_aarch64_rocky9
  script:
#run module v2.0 immediately
    - ./$TEST_NAME -s -f ipv4.*
    - ./$TEST_NAME -s -f ipv6.*
    - ./$TEST_NAME -s -f udp.*
    - ./$TEST_NAME -s -f appstate.*
    - ./$TEST_NAME -s -f timer.*
    - ./$TEST_NAME -s -f proxy.*
    - ./$TEST_NAME -s -f asymmetric.*
    - ./$TEST_NAME -s -f pkt_dump.*
    - ./$TEST_NAME -s -f project.*
    - ./$TEST_NAME -s -f stream_bridge.*
    - ./$TEST_NAME -s -f tunnel.*
    - ./$TEST_NAME -s -f plug_ctrl.*
    - ./$TEST_NAME -s -f jump_layer.*
    - ./$TEST_NAME -s -f hybrid.*
#    - ./$TEST_NAME -s -f inject.*
    - ./$TEST_NAME -s -f offload.*
    - ./$TEST_NAME -s -f tcp.*
    - ./$TEST_NAME -s -f tcpall.*

###############################################################################
# upload 
###############################################################################
.define_before_upload_x86_64_rocky8:
  stage: upload
  image: $BUILD_IMAGE_X86_64_ROCKY8
  before_script:
    - pwd; ls -l ; cd build ; ls -l
    - cp /root/rpm_upload_tools.py ./  
  variables:
    PULP3_REPO_NAME: platform-stable-x86_64.el8
    PULP3_DIST_NAME: platform-stable-x86_64.el8
  only:
    - tags
  tags:
    - tsg-os-builder-el8 

rpm_upload_for_x86_64_rocky8:
  extends: .define_before_upload_x86_64_rocky8
  dependencies:
    - release_build_debug_for_x86_64_rocky8
    - release_build_for_x86_64_rocky8
  script:
    - python3 rpm_upload_tools.py $PULP3_REPO_NAME $PULP3_DIST_NAME *.rpm    

envelope_rpm_upload_for_x86_64_rocky8:
  extends: .define_before_upload_x86_64_rocky8
  dependencies:
    - envelope_rpm_for_x86_64_rocky8
  script:
    - python3 rpm_upload_tools.py $PULP3_REPO_NAME $PULP3_DIST_NAME *-pr-*.rpm    

.define_before_upload_aarch64_rocky9:
  stage: upload
  image: $BUILD_IMAGE_AARCH64_ROCKY9
  before_script:
    - pwd; ls -l ; cd build ; ls -l
    - cp /root/rpm_upload_tools.py ./  
  variables:
    PULP3_REPO_NAME: platform-stable-aarch64.el9
    PULP3_DIST_NAME: platform-stable-aarch64.el9
  only:
    - tags
  tags:
    - tsg-os-builder-aarch64 

rpm_upload_for_aarch64_rocky9:
  extends: .define_before_upload_aarch64_rocky9
  dependencies:
    - release_build_debug_for_aarch64_rocky9
    - release_build_for_aarch64_rocky9
  script:
    - python3 rpm_upload_tools.py $PULP3_REPO_NAME $PULP3_DIST_NAME *.rpm    

envelope_rpm_upload_for_aarch64_rocky9:
  extends: .define_before_upload_aarch64_rocky9
  dependencies:
    - envelope_rpm_for_aarch64_rocky9
  script:
    - python3 rpm_upload_tools.py $PULP3_REPO_NAME $PULP3_DIST_NAME *-pr-*.rpm