Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #44 from bharrisau/travis-stats
Browse files Browse the repository at this point in the history
Adding script to summarise and submit build stats
  • Loading branch information
farcaller committed May 31, 2014
2 parents a3b3ee9 + efaf754 commit a11f1c1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions 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

0 comments on commit a11f1c1

Please sign in to comment.