forked from RedhawkSDR/SigGen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
203 lines (187 loc) · 5.78 KB
/
.gitlab-ci.yml
File metadata and controls
203 lines (187 loc) · 5.78 KB
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
variables:
rh_20_release: '2.0.7'
rh_21_release: '2.1.2'
namespace: rh.
test_suite: test_$CI_PROJECT_NAME.py
#Global before script, determine if this is a tag and handle rpm release field accordingly
before_script:
- safe_version=$(echo ${short_version} | tr -d -)
- safe_ref=$(echo ${CI_COMMIT_REF_NAME} | tr -d /| tr '[:upper:]' '[:lower:]')
- if [ -z "$CI_COMMIT_TAG" ]; then
redhawk_version=${latest_version}
rpm_release="0.$CI_PIPELINE_ID.rh${safe_version}";
else
redhawk_version=${release_version}
rpm_release="`rpm --query --queryformat "%{release}\n" --specfile ${namespace}$CI_PROJECT_NAME.spec | awk -F"." "{print $1}"`.rh${safe_version}";
fi
- redhawk_repo=$yum_repo_url/redhawk-core-framework/$redhawk_version/$dist/$arch
.package: &package
image: ${docker_registry}${docker_rpm_repository}docker:latest-rpm
stage: build
tags:
- dind
script:
# Ensure newest version of FROM image
- docker pull ${docker_registry}${rpmbuild_repository}rpmbuild:${dist}-${arch}-onbuild
- printf "FROM ${docker_registry}${rpmbuild_repository}rpmbuild:$dist-$arch-onbuild" > Dockerfile
- name=$(echo $CI_PROJECT_NAME| tr '[:upper:]' '[:lower:]')
- docker build -t $name:$safe_ref-$dist-$arch-rh${safe_version} --build-arg "project=$CI_PROJECT_NAME"
--build-arg "rpm_release=$rpm_release"
--build-arg "spec_file=${namespace}$CI_PROJECT_NAME.spec"
--build-arg "arch=$arch"
--build-arg "other_repos=$redhawk_repo" .
- id=$(docker create $name:$safe_ref-$dist-$arch-rh${safe_version})
- docker cp $id:/root/rpmbuild/RPMS/ output/
- docker rm -f $id || true
artifacts:
paths:
- output/*/*.rpm
expire_in: 2 days
#Skip on tag of following format
except:
- /^(\d+\.)?(\d+)?(\.\d+)$/
- master
.test: &test
image: ${docker_registry}redhawk/buildenv:${short_version}-$dist-$arch
stage: test
dependencies: []
script:
- . /usr/local/redhawk/python-virtualenv/bin/activate
- yum-config-manager --add-repo $redhawk_repo
- touch /var/lib/rpm/* && yum-builddep --nogpgcheck -y ${namespace}$CI_PROJECT_NAME.spec
- source /etc/profile.d/redhawk.sh
- export SDRROOT=/var/redhawk/sdr
- if [ -d cpp ] && [ "${dist}" == "el7" ]; then
export CXXFLAGS='-g -Og -fprofile-arcs -ftest-coverage' V=1;
fi
- ./build.sh
- cd tests
- env | tee -a ../$CI_PROJECT_NAME-$CI_COMMIT_SHA-tests.log
- pip list | tee -a ../$CI_PROJECT_NAME-$CI_COMMIT_SHA-tests.log
- python $test_suite 2>&1 | tee -a ../$CI_PROJECT_NAME-$CI_COMMIT_SHA-tests.log
- cd ..
- if [ -d cpp ]; then
gcovr -r . --xml --exclude-directories=tests > gcovr.xml;
cppcheck --enable=all --xml-version=2 -i tests . 2> cppcheck-results.xml;
fi
- find * -name '*.cpp' -o -name '*.h' -o -name '*.xml' -o -name '*.py' -o -name '*.java' -o -name '*.log' | tar czvf $CI_PROJECT_DIR/output.tar.gz --files-from -
artifacts:
paths:
- $CI_PROJECT_DIR/output.tar.gz
expire_in: 2 days
#Skip on tag of following format
except:
- /^(\d+\.)?(\d+)?(\.\d+)$/
- master
package:el6:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el6
arch: x86_64
<<: *package
package:el6-i386:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el6
arch: i686
<<: *package
package:el7:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el7
arch: x86_64
<<: *package
package:el6:rh2.1:
variables:
latest_version: 2.1-nightly
release_version: $rh_21_release
short_version: '2.1'
dist: el6
arch: x86_64
<<: *package
package:el6-i386:rh2.1:
variables:
latest_version: 2.1-nightly
release_version: $rh_21_release
short_version: '2.1'
dist: el6
arch: i686
<<: *package
package:el7:rh2.1:
variables:
latest_version: 2.1-nightly
release_version: $rh_21_release
short_version: '2.1'
dist: el7
arch: x86_64
<<: *package
test:el6:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el6
arch: x86_64
<<: *test
only:
- branches
test:el6-i386:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el6
arch: i686
<<: *test
test:el7:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el7
arch: x86_64
<<: *test
test:el6:rh2.1:
variables:
latest_version: 2.1-nightly
release_version: $rh_21_release
short_version: '2.1'
dist: el6
arch: x86_64
<<: *test
test:el6-i386:rh2.1:
variables:
latest_version: 2.1-nightly
release_version: $rh_21_release
short_version: '2.1'
dist: el6
arch: i686
<<: *test
test:el7:rh2.1:
variables:
latest_version: 2.1-nightly
release_version: $rh_21_release
short_version: '2.1'
dist: el7
arch: x86_64
<<: *test
deploy:
image: centos:7
stage: deploy
dependencies: []
before_script:
- echo "Deploying to $jenkins_url/job/$CI_PROJECT_NAMESPACE/job/$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
script:
- if [ -n "$jenkins_url" ]; then
curl --insecure -X POST $jenkins_url/job/$CI_PROJECT_NAMESPACE/job/$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME/buildWithParameters?pipeline_id=$CI_PIPELINE_ID --user $jenkins_user:$jenkins_api_token;
fi
#Skip on tag of following format
except:
- /^(\d+\.)?(\d+)?(\.\d+)$/
- master