-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
129 lines (114 loc) · 3.3 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
image: fedora:38
stages:
- prepare
- build
- deploy
.prepare:coverity: &coverity
cache:
key: coverity
paths:
- .coverity
variables:
COVERITY_RESULTS_DIR: cov-int
before_script:
- d=.coverity
- mkdir -p "$d"
- covtar=$d/coverity.tar.gz
- |
_curl() {
curl --silent --show-error --fail \
-F "token=$COVERITY_TOKEN" -F "project=$COVERITY_PROJECT" https://scan.coverity.com/download/linux64 "$@"
}
- |
if test -e "$covtar"; then
echo "Checking cached coverity scan tool"
rm -f /tmp/coverity.md5 /tmp/coverity.md5.tmp
_curl -F "md5=1" --output /tmp/coverity.md5.tmp
printf '%s\t-' "`sed '1p;d' /tmp/coverity.md5.tmp`" > /tmp/coverity.md5
md5sum -c /tmp/coverity.md5 < "$covtar" || rm -f "$covtar"
fi
- |
if ! test -e "$covtar"; then
echo "Downloading coverity scan tool"
_curl --output "$covtar"
fi
- rm -rf /tmp/opt
- mkdir -p /tmp/opt
- tar xzf "$covtar" -C /tmp/opt --no-same-owner --strip-components=2
- PATH=/tmp/opt/bin:$PATH
- |
_cov_build() {
cov-build --dir "$COVERITY_RESULTS_DIR" "$@"
}
_cov_submit() {
RESULTS_ARCHIVE=/tmp/analysis-results.tgz
echo "==== Importing SCM information"
cov-import-scm --dir "$COVERITY_RESULTS_DIR" --scm git --log "$COVERITY_RESULTS_DIR"/scm_log.txt
rm -f "$RESULTS_ARCHIVE"
echo "==== Creating tarball"
tar czf "$RESULTS_ARCHIVE" "$COVERITY_RESULTS_DIR" --owner root --group root --mode a+rX,go-w
echo "==== Submitting build results"
curl \
--fail --silent --show-error \
--write-out '\n%{http_code}: %{size_upload} bytes uploaded; %{size_download} donwloaded in %{time_connect} seconds\n' \
--form "token=$COVERITY_TOKEN" \
--form "project=$COVERITY_PROJECT" \
--form "file=@$RESULTS_ARCHIVE" \
--form "version=$CI_COMMIT_SHA" \
--form "description=Travis CI build" \
--form "email=$GITLAB_USER_EMAIL" \
https://scan.coverity.com/builds
}
build:
stage: build
coverage: '/^\s*Total:\|(\d+\.\d+\%)\s+.*$/'
artifacts:
expire_in: 1 day
paths:
- build-gcov/.lcov-html
- build-analyze/*.plist
script:
- dnf install -y lcov gcc openssl-devel make clang valgrind libubsan
- |
_make_dir() {
d=build-$1
shift
mkdir -p $d
make -j -C $d -f ../Makefile clean
make -j -C $d -f ../Makefile "$@"
}
# run VPATH builds first
- _make_dir world run-tests
- _make_dir analyze analyze ANALYZE_OUTPUT=html || ':'
- _make_dir gcov run-gcov || ":"
# run non-VPATH build
- make clean
- make -j world
coverity:
<<: *coverity
stage: build
only:
- /^coverity-scan$/
artifacts:
expire_in: 1 day
paths:
- cov-int/
script:
- dnf install -y gcc openssl-devel make git-core
- _cov_build make IN_COVSCAN=1 world
- _cov_submit
pages:
stage: deploy
variables:
GIT_STRATEGY: none
GIT_SUBMODULE_STRATEGY: none
artifacts:
expire_in: 1 week
paths:
- public
dependencies:
- build
script:
- mkdir -p public
- mv build-gcov/.lcov-html public/lcov
- mv build-analyze public/analyze || ':'