From 13cf715906a0959243926b1380851e0f1c70c90e Mon Sep 17 00:00:00 2001 From: Caleb Gilmour Date: Thu, 3 Oct 2019 12:27:30 +1300 Subject: [PATCH] version bump for 1.1.1 and version check scripts enforced by CI (#113) --- .circleci/config.yml | 3 +++ include/datadog/version.h | 2 +- test/version/current_version.cc | 8 ++++++ test/version/version_check | 43 +++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/version/current_version.cc create mode 100755 test/version/version_check diff --git a/.circleci/config.yml b/.circleci/config.yml index 29062612..9971caad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,6 +27,9 @@ jobs: exit 1 fi done + - run: + name: Check version info is up-to-date + command: ./test/version/version_check - run: name: Build source dependencies command: | diff --git a/include/datadog/version.h b/include/datadog/version.h index df7d87a1..52fb03b9 100644 --- a/include/datadog/version.h +++ b/include/datadog/version.h @@ -6,7 +6,7 @@ namespace datadog { namespace version { -const std::string tracer_version = "v1.0.1"; +const std::string tracer_version = "v1.1.1"; const std::string cpp_version = std::to_string(__cplusplus); } // namespace version diff --git a/test/version/current_version.cc b/test/version/current_version.cc new file mode 100644 index 00000000..e539be88 --- /dev/null +++ b/test/version/current_version.cc @@ -0,0 +1,8 @@ +#include + +#include + +int main() { + std::cout << datadog::version::tracer_version << std::endl; + return 0; +} diff --git a/test/version/version_check b/test/version/version_check new file mode 100755 index 00000000..9162293c --- /dev/null +++ b/test/version/version_check @@ -0,0 +1,43 @@ +#!/bin/bash + +if ! cd "${0%/*}"; then + echo "failed to change working directory" + exit 1 +fi + +if ! type git > /dev/null; then + echo "git not available." + exit 0 +fi + +if ! type g++ > /dev/null; then + echo "g++ not available." + exit 0 +fi + +if ! g++ -I"$(git rev-parse --show-toplevel)"/include -o current_version current_version.cc; then + echo "failed to compile current_version.cc" + exit 1 +fi +if ! version=$(./current_version); then + echo "failed to execute current_version" + exit 1 +fi +if ! [[ "$version" ]]; then + echo "empty version info" + exit 1 +fi +rm ./current_version + +if ! git rev-parse "$version" &>/dev/null; then + # already updated + exit 0 +fi + +head_ts=$(git show -s --format=%ct HEAD) +vers_ts=$(git show -s --format=%ct "$version") + +if ((head_ts > vers_ts)); then + echo "version tag is outdated and needs an update" + exit 1 +fi