-
Notifications
You must be signed in to change notification settings - Fork 37
76 lines (63 loc) · 1.72 KB
/
build.yml
File metadata and controls
76 lines (63 loc) · 1.72 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
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
69
70
71
72
73
74
75
76
name: Build
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
workflow_dispatch:
env:
GO_VER: 1.26.0
PROTOC_VER: "33.1"
PROTOC_GEN_GO_VER: v1.36.10
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Checkout Code
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VER }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: ${{ env.PROTOC_VER }}
- name: check go.mod
run: |
go mod tidy
git diff --exit-code go.mod
- name: check vendor
run: |
go mod vendor
git diff --exit-code
- name: go fmt
run: |
go fmt ./...
git diff --exit-code
- name: goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
goimports -l -w `find . -name '*.go' | grep -v vendor | grep -v 'pb.go'`
git diff --exit-code
- name: check protobuf
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@${{ env.PROTOC_GEN_GO_VER }}
protoc --go_opt=paths=source_relative --go_out=. smartbftprotos/*.proto
protoc --go_opt=paths=source_relative --go_out=. examples/naive_chain/*.proto
protoc --go_opt=paths=source_relative --go_out=. test/*.proto
git diff --exit-code
build:
needs:
- validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Checkout Code
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VER }}
- name: Test
run: |
go test -count 1 -race ./...