forked from OpenMPDK/dss-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
111 lines (101 loc) · 3.28 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
variables:
BRANCH_NAME: $CI_COMMIT_BRANCH
SONAR_BRANCH: -Dsonar.branch.name=$CI_COMMIT_BRANCH
SONAR_UNIT_TEST_REPORT: df_out/reports/sonar_qube_ut_coverage_report.xml
COBERTURA_UNIT_TEST_REPORT: df_out/reports/cobertura.xml
image:
name: dss-build_$BRANCH_NAME
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
BRANCH_NAME: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
SONAR_BRANCH: ''
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "push"
- if: $CI_COMMIT_BRANCH =~ /^(stable|feature)\/.*/ && $CI_PIPELINE_SOURCE == "push"
stages:
- build
- lint
- test
- scan
- archive
build dss-sdk:
stage: build
script:
# Download build wrapper from local SonarQube
- rm -rf /build-wrapper-linux-x86
- wget --no-verbose --content-disposition -E -c "$SONAR_HOST_URL/static/cpp/build-wrapper-linux-x86.zip"
- unzip -q build-wrapper-linux-x86.zip -d /
# Disable ssl verify from docker build env
- git config --global http.sslVerify false
# Build client with build-wrapper
- /build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output/ ./scripts/build_all.sh kdd-samsung-remote
variables:
GIT_SUBMODULE_STRATEGY: recursive
artifacts:
name: release build
expire_in: 300 seconds
paths:
- bw-output
- df_out
- host_out
build target gcov and execute unit tests:
stage: build
script: ./target/build.sh --run-tests --with-coverage
artifacts:
name: gcov build
expire_in: 300 seconds
paths:
- df_out
variables:
GIT_SUBMODULE_STRATEGY: recursive
target unit test coverage report:
stage: test
script:
- gcovr --xml $COBERTURA_UNIT_TEST_REPORT -r target/ df_out/
- sed -i -r 's/filename="/filename="target\//g' $COBERTURA_UNIT_TEST_REPORT
- sed -i -r 's/path="/path="target\//g' $SONAR_UNIT_TEST_REPORT
artifacts:
name: target unit test coverage report
expire_in: 300 seconds
paths:
- $SONAR_UNIT_TEST_REPORT
reports:
coverage_report:
coverage_format: cobertura
path: $COBERTURA_UNIT_TEST_REPORT
needs:
- build target gcov and execute unit tests
sonar-scanner:
stage: scan
script:
# Download latest sonar-scanner from sonar-source
- rm -rf /sonar-scanner*
- wget --no-verbose --content-disposition -E -c "https://search.maven.org/remote_content?g=org.sonarsource.scanner.cli&a=sonar-scanner-cli&v=LATEST&c=linux&e=zip"
- unzip -q sonar-scanner-cli-*.zip -d /
# Scan with sonar-scanner
- /sonar-scanner-*-linux/bin/sonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.coverageReportPaths=$SONAR_UNIT_TEST_REPORT
allow_failure: true
dependencies:
- build dss-sdk
- target unit test coverage report
pycodestyle:
stage: lint
script: git ls-files '*.py' | xargs -n1 pycodestyle --config=./scripts/pycodestyle --show-source --show-pep8
needs: []
shellcheck:
stage: lint
script: git ls-files '*.sh' | xargs -n1 shellcheck
needs: []
archive dss-sdk:
stage: archive
script: /stagemergeartifacts.sh
variables:
DSSGLOBLIST: "nkv-sdk-*.tgz nkv-target-*.tgz"
needs:
- build dss-sdk
artifacts:
name: release artifacts
paths:
- df_out/nkv-target-*.tgz
- host_out/nkv-sdk-bin-*.tgz