File tree Expand file tree Collapse file tree 7 files changed +698
-939
lines changed
Expand file tree Collapse file tree 7 files changed +698
-939
lines changed Original file line number Diff line number Diff line change 11name : Build
22
33on :
4+ push :
5+ branches : [ "**" ]
46 pull_request :
7+ branches : [ "**" ]
8+ workflow_dispatch :
9+
10+ env :
11+ GO_VER : 1.24.1
12+ PROTOC_VER : 29.3
13+ PROTOC_GEN_GO_VER : v1.36.5
514
615jobs :
16+ validate :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v4
20+ name : Checkout Code
21+
22+ - name : Install Go
23+ uses : actions/setup-go@v5
24+ with :
25+ go-version : ${{ env.GO_VER }}
26+
27+ - name : Install Protoc
28+ uses : arduino/setup-protoc@v3
29+ with :
30+ version : ${{ env.PROTOC_VER }}
31+
32+ - name : check go.mod
33+ run : |
34+ go mod tidy
35+ git diff --exit-code go.mod
36+
37+ - name : check vendor
38+ run : |
39+ go mod vendor
40+ git diff --exit-code
41+
42+ - name : go fmt
43+ run : |
44+ go fmt ./...
45+ git diff --exit-code
46+
47+ - name : goimports
48+ run : |
49+ go install golang.org/x/tools/cmd/goimports@latest
50+ goimports -l -w `find . -name '*.go' | grep -v vendor | grep -v 'pb.go'`
51+ git diff --exit-code
52+
53+ - name : check protobuf
54+ run : |
55+ go install google.golang.org/protobuf/cmd/protoc-gen-go@${{ env.PROTOC_GEN_GO_VER }}
56+ make protos
57+ git diff --exit-code
758
859 build :
60+ needs :
61+ - validate
962 runs-on : ubuntu-latest
1063 steps :
1164 - uses : actions/checkout@v4
1467 - name : Install Go
1568 uses : actions/setup-go@v5
1669 with :
17- go-version : 1.22.4
18-
19- - name : Prepare Env
20- run : bash scripts/prepare_environ.sh
70+ go-version : ${{ env.GO_VER }}
2171
2272 - name : Test
23- working-directory : /home/runner/go/src/github.com/hyperledger-labs/SmartBFT
24- run : make all
25-
26- - name : Post
27- working-directory : /home/runner/go/src/github.com/hyperledger-labs/SmartBFT
28- run : ./scripts/post.sh
73+ run : |
74+ go test -count 1 -race ./...
Original file line number Diff line number Diff line change 55 bash ./scripts/build_checks.sh
66protos :
77 protoc --go_opt=paths=source_relative --go_out=. smartbftprotos/* .proto
8- find . -name " *.pb.go" | grep -v " ^./vendor" | xargs goimports -w
8+ protoc --go_opt=paths=source_relative --go_out=. examples/naive_chain/* .proto
9+ protoc --go_opt=paths=source_relative --go_out=. test/* .proto
Original file line number Diff line number Diff line change @@ -10,21 +10,21 @@ err() {
1010
1111echo -e " \nTesting commit: ------${ANSI_GREEN} " $( git log -1 --no-merges | head -$(( $(git log - 1 -- no- merges | wc - l) - 2 )) | tail -1) " ${ANSI_RESET} ------\n"
1212
13- go get -u golang.org/x/tools/cmd/goimports
14- go get -u google.golang.org/protobuf/cmd/protoc-gen-go
15-
13+ go install golang.org/x/tools/cmd/goimports@latest
14+ go install google.golang.org/protobuf/cmd/
[email protected] 1615
1716BUILDDIR=.build
1817if [ ! -d " $BUILDDIR " ]; then
1918 mkdir $BUILDDIR
2019fi
2120cd $BUILDDIR
2221
23- PROTOC_ZIP=protoc-3.8.0-linux-x86_64.zip
22+ PROTOC_VER=29.3
23+ PROTOC_ZIP=protoc-$PROTOC_VER -linux-x86_64.zip
2424if [ ! -f " $PROTOC_ZIP " ]; then
2525 echo " $PROTOC_ZIP does not exist"
26- wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-linux-x86_64.zip
27- unzip protoc-3.12.3-linux-x86_64.zip
26+ wget https://github.com/protocolbuffers/protobuf/releases/download/v $PROTOC_VER / $PROTOC_ZIP
27+ unzip $PROTOC_ZIP
2828fi
2929
3030export PATH=$PATH :$BUILDDIR /bin/
5252fi
5353
5454make protos
55- # git status | grep "pb.go" | grep -q "modified"
56- # if [ $? -eq 0 ];then
57- # git status
58- # err "protobuf not up to date"
59- # git diff
60- # exit 1
61- # fi
55+ git status | grep " pb.go" | grep -q " modified"
56+ if [ $? -eq 0 ]; then
57+ git status
58+ err " protobuf not up to date"
59+ git diff
60+ exit 1
61+ fi
6262
6363( sleep 600; ps -ef | grep test | grep -v " go test" | grep -v grep | awk ' {print $2}' | xargs kill -SIGABRT ) &
6464
You can’t perform that action at this time.
0 commit comments