Skip to content

Commit

Permalink
version bump for 1.1.1 and version check scripts enforced by CI (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilmour authored Oct 2, 2019
1 parent 010c5ac commit 13cf715
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion include/datadog/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/version/current_version.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <datadog/version.h>

#include <iostream>

int main() {
std::cout << datadog::version::tracer_version << std::endl;
return 0;
}
43 changes: 43 additions & 0 deletions test/version/version_check
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 13cf715

Please sign in to comment.