From efaf75471b6fd2e34c227abb22654b410e85dbf2 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 23 May 2014 05:30:21 +0800 Subject: [PATCH] Adding script to summarise and submit build stats --- .travis.yml | 2 ++ support/record_stats.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 support/record_stats.sh diff --git a/.travis.yml b/.travis.yml index 07a11561..c27bf3c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ before_script: - $RUSTC --version script: - rake build_all +after_success: + - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && ./support/record_stats.sh env: matrix: - PLATFORM=lpc17xx diff --git a/support/record_stats.sh b/support/record_stats.sh new file mode 100755 index 00000000..3afaa710 --- /dev/null +++ b/support/record_stats.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -eu +set -o pipefail +IFS=$'\n\t' + +stats="{\"version_rust\":\"$($RUSTC --version | head -n 1)\"," +stats="$stats \"version_zinc\":\"$(git rev-parse HEAD)\"," +stats="$stats \"version_date\":\"$(date)\"," + +lines=$(arm-none-eabi-size build/*.elf | tail -n +2) +IFS=$'\n' +for line in ${lines[@]}; do + IFS=$'\n\t ' + read -ra stat <<< "$line" + file=${stat[5]} + file=${file#build/app_} + file=${file%\.elf} + stats="$stats \"$file\":\"${stat[0]}-${stat[1]}-${stat[2]}\"," +done +IFS=$'\n\t' + +stats="$stats \"version_platform\":\"$PLATFORM\"}," + +echo "Submitting statistics" +git clone -b $PLATFORM git@github.com:bharr/zinc-stats +cd zinc-stats +sed -i '$ d' stats.json +echo "$stats" >> stats.json +echo "{}]" >> stats.json +rm -f *.lst *.map +cp ../build/*.lst ../build/*.map . +git add -A . +git commit -m "Updated build $(date)" +git push origin +$PLATFORM