-
Notifications
You must be signed in to change notification settings - Fork 24
/
run-checks.sh
executable file
·65 lines (58 loc) · 1.25 KB
/
run-checks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
cd "$(dirname "$0")"
BASEDIR=$(pwd)
if ! hash go; then
echo "please install go and try again"
exit 1
fi
if ! hash staticcheck; then
echo "installing staticcheck"
if ! go install honnef.co/go/tools/cmd/[email protected]; then
echo "failed to install staticcheck"
exit 1
fi
fi
if ! hash builder; then
echo "installing the opentelemetry collector builder"
if ! go install go.opentelemetry.io/collector/cmd/[email protected]; then
echo "failed to install the opentelemetry collector builder"
exit 1
fi
fi
for package in common influx2otel otel2influx jaeger-influxdb tests-integration; do
echo checking ${package}
cd "${BASEDIR}/${package}"
go mod tidy
if ! git diff --exit-code -- go.mod go.sum; then
fail=1
fi
if ! go build ./...; then
fail=1
fi
if ! go test ./...; then
fail=1
fi
if [[ -n $(gofmt -s -l . | head -n 1) ]]; then
fail=1
gofmt -s -d .
fi
if ! go vet ./...; then
fail=1
fi
if ! staticcheck -f stylish ./...; then
fail=1
fi
done
echo checking otelcol-influxdb
cd "${BASEDIR}/otelcol-influxdb"
if ! builder --config build.yml; then
fail=1
fi
echo
if [ -n "$fail" ]; then
echo "at least one check failed"
exit 1
else
echo "all checks OK"
fi