File tree 7 files changed +698
-939
lines changed
7 files changed +698
-939
lines changed Original file line number Diff line number Diff line change 1
1
name : Build
2
2
3
3
on :
4
+ push :
5
+ branches : [ "**" ]
4
6
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
5
14
6
15
jobs :
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
7
58
8
59
build :
60
+ needs :
61
+ - validate
9
62
runs-on : ubuntu-latest
10
63
steps :
11
64
- uses : actions/checkout@v4
14
67
- name : Install Go
15
68
uses : actions/setup-go@v5
16
69
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 }}
21
71
22
72
- 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 5
5
bash ./scripts/build_checks.sh
6
6
protos :
7
7
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() {
10
10
11
11
echo -e " \nTesting commit: ------${ANSI_GREEN} " $( git log -1 --no-merges | head -$(( $(git log - 1 -- no- merges | wc - l) - 2 )) | tail -1) " ${ANSI_RESET} ------\n"
12
12
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]
16
15
17
16
BUILDDIR=.build
18
17
if [ ! -d " $BUILDDIR " ]; then
19
18
mkdir $BUILDDIR
20
19
fi
21
20
cd $BUILDDIR
22
21
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
24
24
if [ ! -f " $PROTOC_ZIP " ]; then
25
25
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
28
28
fi
29
29
30
30
export PATH=$PATH :$BUILDDIR /bin/
52
52
fi
53
53
54
54
make 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
62
62
63
63
( sleep 600; ps -ef | grep test | grep -v " go test" | grep -v grep | awk ' {print $2}' | xargs kill -SIGABRT ) &
64
64
You can’t perform that action at this time.
0 commit comments