CI build support 20/720/2 v0.0.2
authorRoni Riska <roni.riska@nokia.com>
Thu, 15 Aug 2019 07:21:49 +0000 (10:21 +0300)
committerRoni Riska <roni.riska@nokia.com>
Thu, 15 Aug 2019 12:24:23 +0000 (15:24 +0300)
The CI Docker file runs unit tests and builds the binary packages
of tracelibcpp and opentracing-cpp.

Change-Id: I8f4d6e7db08b890ba8bfc5d5594a4a1cb7cb279f
Signed-off-by: Roni Riska <roni.riska@nokia.com>
.gitreview [new file with mode: 0644]
CMakeLists.txt
ci/Dockerfile [new file with mode: 0644]
ci/build_opentracing.sh [new file with mode: 0755]
ci/ci_build.sh [new file with mode: 0755]
ci/publish.sh [new file with mode: 0755]

diff --git a/.gitreview b/.gitreview
new file mode 100644 (file)
index 0000000..99ac43c
--- /dev/null
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.o-ran-sc.org
+port=29418
+project=ric-plt/tracelibcpp.git
+defaultbranch=master
+
index 1c5ad29..a3b0e0d 100644 (file)
@@ -33,10 +33,38 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/cxx1.cmake)
 
 set (tracelibcpp_VERSION_MAJOR "0")
 set (tracelibcpp_VERSION_MINOR "0")
-set (tracelibcpp_VERSION_MICRO "1")
+set (tracelibcpp_VERSION_MICRO "2")
 set (tracelibcpp_VERSION_STRING
     "${tracelibcpp_VERSION_MAJOR}.${tracelibcpp_VERSION_MINOR}.${tracelibcpp_VERSION_MICRO}")
 
+# Set up cpack
+# Common
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ implementation RIC tracing initialization")
+set(CPACK_PACKAGE_VENDOR "Nokia")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
+set(CPACK_PACKAGE_VERSION_MAJOR ${tracelibcpp_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${tracelibcpp_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${tracelibcpp_VERSION_MICRO})
+set(CPACK_COMPONENTS_ALL DIST DEVEL)
+set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP )
+set(CPACK_GENERATOR "RPM;DEB")
+set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+set(CPACK_PACKAGE_CONTACT None)
+
+# RPM
+set(CPACK_RPM_COMPONENT_INSTALL ON)
+set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
+set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
+set(CPACK_RPM_PACKAGE_AUTOREQ 1)
+
+# Debian
+set(CPACK_DEB_COMPONENT_INSTALL ON)
+set(CPACK_DEB_PACKAGE_COMPONENT ON)
+set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
+set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+
+include(CPack)
+
 # Add jaeger
 hunter_add_package(jaegertracing)
 find_package(jaegertracing CONFIG REQUIRED)
diff --git a/ci/Dockerfile b/ci/Dockerfile
new file mode 100644 (file)
index 0000000..3a10250
--- /dev/null
@@ -0,0 +1,35 @@
+# O-RAN-SC
+#
+# Copyright (C) 2019 AT&T Intellectual Property and Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# CI to verify the tracingcpp library
+# Inherits C toolchain from buildpack-deps:stretch
+# Adds required build tools
+
+FROM buildpack-deps:stretch
+
+RUN apt-get update && apt-get -q -y install \
+  cmake \
+  rpm \
+  rename \
+  alien
+
+RUN mkdir -p /tmp/build
+COPY . /tmp/build
+RUN cd /tmp/build && ci/ci_build.sh
+
+RUN cd /tmp/build && ci/build_opentracing.sh
+
+ENTRYPOINT ["/tmp/build/ci/publish.sh"]
diff --git a/ci/build_opentracing.sh b/ci/build_opentracing.sh
new file mode 100755 (executable)
index 0000000..b2a5753
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 AT&T Intellectual Property.
+# Copyright (c) 2018-2019 Nokia.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+set -e
+
+REL=1.5.0
+
+wget https://github.com/opentracing/opentracing-cpp/archive/v$REL.tar.gz -O opentracing-cpp-$REL.tar.gz
+tar zxf opentracing-cpp-$REL.tar.gz
+cd opentracing-cpp-$REL
+
+cmake .
+make package
+cpack -G RPM -D CPACK_RPM_FILE_NAME=RPM-DEFAULT
+alien opentracing-cpp-$REL-1.x86_64.rpm --keep-version
+mv *.rpm *.deb ..
diff --git a/ci/ci_build.sh b/ci/ci_build.sh
new file mode 100755 (executable)
index 0000000..5caa2b8
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 AT&T Intellectual Property.
+# Copyright (c) 2018-2019 Nokia.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+
+# UT
+cmake -DWITH_TESTING=ON -DHUNTER_JOBS_NUMBER=3 .
+make && make test
+
+# Build packages
+make package
+# Do small renames
+rename 's/-DEVEL/-devel/' *.rpm
+rename 's/-DIST//' *.rpm
+rename 's/-devel/-dev/' *.deb
+rename 's/-dist//' *.deb
diff --git a/ci/publish.sh b/ci/publish.sh
new file mode 100755 (executable)
index 0000000..3854617
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 AT&T Intellectual Property.
+# Copyright (c) 2018-2019 Nokia.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+echo "$0: start copying packages"
+
+TARGET=/export
+if [ $# -eq 1 ]
+then
+    TARGET=$1
+fi
+
+if [ ! -d "$TARGET" ]
+then
+    echo "$0: Error: target dir $TARGET does not exist"
+    exit 1
+fi
+
+cp -v /tmp/build/*.rpm /tmp/build/*.deb "$TARGET"