@@ -3,8 +3,12 @@ schedules:
33 schedule : adhoc
44 notify :
55 slack : cpp-driver-dev-bots
6+ commit :
7+ schedule : per_commit
8+ notify :
9+ slack : cpp-driver-dev-bots
610 branches :
7- include : [master]
11+ include : ["/CPP-\\d+/", " master" ]
812architecture :
913 - x64
1014os :
1317 - ubuntu/xenial64
1418 - centos/6-64
1519 - centos/7-64
20+ env :
21+ LIBUV_VERSION : 1.23.0
1622build :
1723 - script : |
18- echo "Running packaging job"
19- package :
20- include : # list of files and glob paths to include in the artifact, relative to the current working directory
21- - packaging/packages/*
22- release :
23- notify :
24- slack : cpp-driver-dev-bots
25- after :
26- each :
27- - script : |
28- LIBUV_VERSION=1.23.0
29- CC=gcc
30- TEST_PROGRAM=$(mktemp)
31- TOKENS=($(echo ${OS_VERSION} | tr "/" " "))
32- DISTRO=${TOKENS[0]}
33- RELEASE=${TOKENS[1]}
34- SHA=$(echo $GIT_COMMIT | cut -c1-7)
35- HEADER_FILE="include/cassandra.h"
36-
37- if [ "${DISTRO}" = "ubuntu" ]; then
38- NAME=$(echo ${RELEASE%??})
39- ARCHITECTURE=${RELEASE:-2}
40- PACKAGE_TYPE=deb
41- PACKAGE_INSTALL="dpkg -i"
42- if [ "${NAME}" = "trusty" ]; then
43- RELEASE=14.04
44- elif [ "${NAME}" = "xenial" ]; then
45- RELEASE=16.04
46- elif [ "${NAME}" = "bionic" ] || [ "${NAME}" = "bionic64" ]; then
47- RELEASE=18.04
48- else
49- printf "Unsupported Ubuntu Version: %s\n" ${RELEASE}
50- exit 1
51- fi
52- elif [ "${DISTRO}" = "centos" ]; then
53- TOKENS=($(echo ${RELEASE} | tr "-" " "))
54- NAME=${DISTRO}
55- RELEASE=${TOKENS[0]}
56- ARCHITECTURE=${TOKENS[1]}
57- PACKAGE_TYPE=rpm
58- PACKAGE_INSTALL="rpm -i"
59- else
60- printf "Unsupported OS: %s\n" ${OS_VERSION}
61- exit 1
62- fi
24+ . .build.sh
25+ configure_environment
26+ install_dependencies
6327
64- # Extract driver version from the header file
65- DRIVER_VERSION=$(grep '#define[ \t]\+CASS_VERSION_\(MAJOR\|MINOR\|PATCH\|SUFFIX\)' $HEADER_FILE | awk '
66- BEGIN { major="?"; minor="?"; patch="?" }
67- /CASS_VERSION_MAJOR/ { major=$3 }
68- /CASS_VERSION_MINOR/ { minor=$3 }
69- /CASS_VERSION_PATCH/ { patch=$3 }
70- /CASS_VERSION_SUFFIX/ { suffix=$3; gsub(/"/, "", suffix) }
71- END {
72- if (length(suffix) > 0)
73- printf "%s.%s.%s-%s", major, minor, patch, suffix
74- else
75- printf "%s.%s.%s", major, minor, patch
76- }
77- ')
28+ build_driver 'CASS'
7829
79- if [[ ! $DRIVER_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9_\-]+)?$ ]]; then
80- echo "Unable to extract version from $HEADER_FILE"
81- exit 1
82- fi
30+ FUNCTIONS+=($(grep -Eoh '^cass_\s*(\w+)\s*\(' include/cassandra.h | awk -F '(' '{print $1}'))
31+ check_driver_exports 'build/libcassandra_static.a' "${FUNCTIONS[@]}"
8332
84- pushd packaging
85- mkdir -p packages
33+ build/cassandra-unit-tests --gtest_output=xml:cassandra-unit-test-results.xml
8634
87- echo "Building libuv Packages [${LIBUV_VERSION}] ...\n"
88- git clone --depth 1 https://github.com/datastax/libuv-packaging.git libuv-packaging
89- pushd libuv-packaging
90- ./build_${PACKAGE_TYPE}.sh ${LIBUV_VERSION}
91- popd
92- find libuv-packaging/build -type f -name "*.${PACKAGE_TYPE}" -exec mv {} packages \;
93- sudo ${PACKAGE_INSTALL} packages/libuv*.${PACKAGE_TYPE}
35+ install_driver
36+ test_installed_driver 'cassandra'
9437
95- echo "Building DataStax C/C++ driver ..."
96- ./build_${PACKAGE_TYPE}.sh
97- find build -type f -name "*.${PACKAGE_TYPE}" -exec mv {} packages \;
98- sudo ${PACKAGE_INSTALL} packages/cassandra*.${PACKAGE_TYPE}
99-
100- # Create test file against cpp-driver and try to connect.
101- # Should compile and throw a connection error when executed.
102- $CC -x c -o $TEST_PROGRAM - -Wno-implicit-function-declaration -lcassandra - <<EOF
103- #include <cassandra.h>
104- int main(int argc, char* argv[]) {
105- CassFuture* connect_future = NULL;
106- CassCluster* cluster = cass_cluster_new();
107- CassSession* session = cass_session_new();
108- cass_cluster_set_contact_points(cluster, "127.0.0.1");
109- connect_future = cass_session_connect(session, cluster);
110- cass_future_wait(connect_future);
111- printf("Success\n");
112- return 0;
113- }
114- EOF
115-
116- # Throw error if either compilation or test run fails
117- if [ $? -ne 0 ] ; then
118- echo "Connection test compilation failed. Marking build as failure."
119- exit 1
120- fi
121-
122- if [ "$($TEST_PROGRAM)" != "Success" ] ; then
123- echo "Connection test did not return success. Marking build as failure."
124- exit 1
125- fi
126-
127- # Uploading driver packages
128- curl -$ARTIFACTORY_CREDS -T "{$(echo packages/cassandra-cpp-driver* | tr ' ' ',')}" "https://datastax.jfrog.io/datastax/cpp-php-drivers/cpp-driver/builds/$version/$SHA/$DISTRO/$RELEASE/cassandra/v$DRIVER_VERSION/"
129-
130- # Uploading libuv packages
131- curl -$ARTIFACTORY_CREDS -T "{$(echo packages/libuv* | tr ' ' ',')}" "https://datastax.jfrog.io/datastax/cpp-php-drivers/cpp-driver/builds/$version/$SHA/$DISTRO/$RELEASE/dependencies/libuv/v$LIBUV_VERSION/"
132- popd
38+ - xunit :
39+ - " *unit-test-results.xml"
40+ package :
41+ include : # list of files and glob paths to include in the artifact, relative to the current working directory
42+ - packaging/packages/*
43+ release :
44+ after :
45+ each :
46+ - script : |
47+ . .build.sh
48+ DRIVER_VERSION=$(get_driver_version 'include/cassandra.h' 'CASS')
49+ # Uploading driver packages
50+ curl -$ARTIFACTORY_CREDS -T "{$(echo packaging/packages/cassandra-cpp-driver* | tr ' ' ',')}" "https://datastax.jfrog.io/datastax/cpp-php-drivers/cpp-driver/builds/$version/$SHA/$DISTRO/$RELEASE/cassandra/v$DRIVER_VERSION/"
51+ # Uploading libuv packages
52+ curl -$ARTIFACTORY_CREDS -T "{$(echo packaging/packages/libuv* | tr ' ' ',')}" "https://datastax.jfrog.io/datastax/cpp-php-drivers/cpp-driver/builds/$version/$SHA/$DISTRO/$RELEASE/dependencies/libuv/v$LIBUV_VERSION/"
0 commit comments