-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
114 lines (104 loc) · 3.42 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
variables:
BRANCH_NAME: $CI_COMMIT_BRANCH
SONAR_BRANCH: -Dsonar.branch.name=$CI_COMMIT_BRANCH
PYTEST_COV_REPORT: .coverage-reports/coverage-datamover.xml
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"
image:
name: dss-build_$BRANCH_NAME
stages:
- build
- test
- lint
- scan
- archive
build dss_client:
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
# Download RDD deps
- ./dss_client/scripts/getrdddeps.sh
# Build client with build-wrapper
- /build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output/ ./dss_client/scripts/build.sh
artifacts:
name: dss client build
expire_in: 300 seconds
paths:
- dss_client
- bw-output
package datamover:
stage: build
script:
- git config --global http.sslVerify false
- git fetch --tags
- export RELEASESTRING=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)
- git archive --format=tgz -19 --output="nkv-datamover-$RELEASESTRING.tgz" HEAD:dss_datamover
artifacts:
name: datamover package
expire_in: 300 seconds
paths:
- nkv-datamover-*.tgz
datamover unit test:
stage: test
script:
# Install dependencies to execute Datamover unit tests
- yum install libcap-devel -y
- python3 -m pip install -r dss_datamover/requirements.txt
- python3 -m pip install -r dss_datamover/unittests/requirements.txt
# Execute Datamover pytest with XML coverage report
- cd dss_datamover && mkdir -p .coverage-reports && python3 -m pytest unittests -v -rA --cov=. --cov-report=xml:../$PYTEST_COV_REPORT --color=yes --disable-warnings
artifacts:
name: datamover unit test coverage report
expire_in: 300 seconds
paths:
- $PYTEST_COV_REPORT
reports:
coverage_report:
coverage_format: cobertura
path: $PYTEST_COV_REPORT
needs: []
sonar-scanner:
stage: scan
script:
# Download sonar-scanner from local SonarQube
- 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 /
- /sonar-scanner-*-linux/bin/sonar-scanner $SONAR_BRANCH -Dsonar.python.coverage.reportPaths=$PYTEST_COV_REPORT
allow_failure: true
dependencies:
- datamover unit test
- build dss_client
pycodestyle:
stage: lint
script: pycodestyle $PROJECT --show-source --show-pep8
parallel:
matrix:
- PROJECT:
- dss_ai_benchmark
- dss_client
- dss_datamover
needs: []
archive dss-ecosystem:
stage: archive
script: /stagemergeartifacts.sh
variables:
DSSGLOBLIST: "dss_client-*.tgz nkv-datamover-*.tgz"
needs:
- build dss_client
- package datamover
artifacts:
paths:
- dss_client/dss_client-*.tgz
- nkv-datamover-*.tgz