mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Typescript: Fixing typescript strict error, and separate check from publishing (#29679)
* Typescript: Fixing typescript string error, and seperate check from publishing * now should pass
This commit is contained in:
13
scripts/ci-check-strict.sh
Executable file
13
scripts/ci-check-strict.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
ERROR_COUNT_LIMIT=579
|
||||
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
|
||||
|
||||
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||
echo -e "Typescript strict errors $ERROR_COUNT exceeded $ERROR_COUNT_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
ERROR_COUNT_LIMIT=580
|
||||
DIRECTIVES_LIMIT=172
|
||||
CONTROLLERS_LIMIT=139
|
||||
|
||||
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict 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)"
|
||||
@@ -14,21 +8,6 @@ STORIES_COUNT="$(find ./packages/grafana-ui/src/components -name "*.story.tsx" |
|
||||
MDX_COUNT="$(find ./packages/grafana-ui/src/components -name "*.mdx" | wc -l)"
|
||||
LEGACY_FORMS="$(grep -r -oP 'LegacyForms;' public/app | wc -l)"
|
||||
|
||||
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||
echo -e "Typescript strict errors $ERROR_COUNT exceeded $ERROR_COUNT_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$DIRECTIVES" -gt $DIRECTIVES_LIMIT ]; then
|
||||
echo -e "Directive count $DIRECTIVES exceeded $DIRECTIVES_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$CONTROLLERS" -gt $CONTROLLERS_LIMIT ]; then
|
||||
echo -e "Controllers count $CONTROLLERS exceeded $CONTROLLERS_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "Typescript errors: $ERROR_COUNT"
|
||||
echo -e "Directives: $DIRECTIVES"
|
||||
echo -e "Controllers: $CONTROLLERS"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Publishing CI Metrics"
|
||||
|
||||
data=""
|
||||
|
||||
for ((i = 1; i <= $#; i++ )); do
|
||||
remainder="${!i}"
|
||||
# Find everything until last = character (= is included in the result)
|
||||
# This allows to add tags to metric names
|
||||
metricName=$(grep -o "\(.*\)=" <<< "$remainder")
|
||||
# Get the metric value
|
||||
value=${remainder#"$metricName"}
|
||||
# Remove remaining = character from metric name
|
||||
metricName=${metricName%?};
|
||||
|
||||
|
||||
if [ -n "$data" ]; then
|
||||
data="$data,"
|
||||
fi
|
||||
data=''$data'{"name": "'${metricName}'", "value": '${value}', "interval": 60, "mtype": "gauge", "time": '$(date +%s)'}'
|
||||
done
|
||||
|
||||
echo "Publishing metrics:"
|
||||
echo "$data"
|
||||
curl "https://6371:$GRAFANA_MISC_STATS_API_KEY@graphite-us-central1.grafana.net/metrics" \
|
||||
-H 'Content-type: application/json' \
|
||||
-d "[$data]"
|
||||
Reference in New Issue
Block a user