-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_checks.sh
More file actions
executable file
·41 lines (32 loc) · 1.11 KB
/
run_checks.sh
File metadata and controls
executable file
·41 lines (32 loc) · 1.11 KB
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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Run go vet
echo "Running go vet..."
go vet ./...
# Run golangci-lint
echo "Running golangci-lint..."
golangci-lint run
# Run go test -race
echo 'Running go test -race...'
timeout 30s go test -race -v ./... 2>&1 | awk '/^FAIL/ || /--- FAIL:/ {print}'
GO_TEST_STATUS=${PIPESTATUS[0]}
if [ $GO_TEST_STATUS -ne 0 ]; then
echo "Tests failed. Exiting with status $GO_TEST_STATUS."
exit $GO_TEST_STATUS
else
echo "All tests passed."
fi
# Run go build
echo "Running go build..."
go build -o bot-detector ./cmd/bot-detector
# Run gofmt
echo "Running gofmt..."
find . -name "*.go" -print0 | xargs -0 gofmt -w
# Run bot-detector --dry-run with testdata
echo "Running bot-detector --dry-run with testdata..."
./bot-detector --dry-run --config-dir testdata --log-path testdata/test_access.log --top-n 10
# Test multi-website config validation (config check only, dry-run not yet supported for multi-website)
echo "Validating multi-website configuration..."
./bot-detector --check --config-dir testdata/multiwebsite
echo "All checks passed!"