-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_verify.sh
executable file
·68 lines (57 loc) · 1.64 KB
/
ci_verify.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
66
67
68
#!/bin/sh
set -e
# run through all the checks done for ci
# only exit error when fmt or tidy changes source if working directory pristine
_git_status_output=$(git status --porcelain)
(cd www && pnpm build)
if ! command -v "golangci-lint" >/dev/null 2>&1; then
echo '*** install golangci-lint'
brew tap golangci/tap
brew install golangci/tap/golangci-lint
else
echo '*** check for golangci-lint upgrade'
brew upgrade golangci/tap/golangci-lint
fi
echo '\n*** build ***'
go build
echo '\n*** fmt/tidy composable ***'
(cd composable && go mod tidy)
(cd composable && go fmt .)
echo '\n*** fmt/tidy git ***'
(cd git && go mod tidy)
(cd git && go fmt .)
echo '\n*** fmt/tidy testutil ***'
(cd testutil && go mod tidy)
(cd testutil && go fmt .)
echo '\n*** fmt/tidy util ***'
(cd util && go mod tidy)
(cd util && go fmt .)
echo '\n*** fmt/tidy . ***'
go mod tidy
go fmt .
if [ -z "$_git_status_output" ]; then
echo "check go mod tidy and fmt changes were made"
git diff --exit-code
fi
echo '\n*** lint composable ***'
(cd composable && golangci-lint run)
echo '\n*** lint git ***'
(cd git && golangci-lint run)
echo '\n*** lint testutil ***'
(cd testutil && golangci-lint run)
echo '\n*** lint util ***'
(cd util && golangci-lint run)
echo '\n*** lint . ***'
golangci-lint run
echo '\n*** test ***'
go list -f '{{.Dir}}' -m | xargs go test
echo '\n*** integration test ***'
PATH="$PATH:$(pwd)"
(cd integration/rust && cargo build)
(cd integration && go run integration.go)
if [ -n "$_git_status_output" ]; then
echo
echo "all ci verifications passed"
echo "however, working directory had uncommited changes before running go fmt and go mod tidy"
exit 1
fi