POC on collecting metrics in ci process

This commit is contained in:
Torkel Ödegaard 2019-03-12 14:42:36 +01:00
parent 51c06a8c46
commit 3e2350be87
2 changed files with 17 additions and 0 deletions

16
scripts/circle-metrics.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --noImplicitAny true | grep -oP 'Found \K(\d+)')"
DIRECTIVES="$(grep -r -o directive public/app/**/* | wc -l)"
CONTROLLERS="${grep -r -oP \"class .*Ctrl\" public/app/**/* | wc -l}"
echo "Typescript errors: $ERROR_COUNT"
echo "Directives: $DIRECTIVES"
echo "Controllers: $CONTROLLERS"
curl \
-d "{\"metrics\":{\"noImplicitAny\": $ERROR_COUNT}}" \
-H "Content-Type: application/json" \
-u ci:$CIRCLE_STATS \
-X POST https://stats.grafana.org/metric-receiver

View File

@ -10,5 +10,6 @@ function exit_if_fail {
fi
}
exit_if_fail ./circle-metrics.sh
exit_if_fail npm run prettier:check
exit_if_fail npm run test