-
Notifications
You must be signed in to change notification settings - Fork 5
68 lines (59 loc) · 1.67 KB
/
buf-pr.yml
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
name: check buf generate up to date
on:
pull_request:
branches:
- main
paths:
- "**.go"
- "**.proto"
- "**.go.json"
- "go.mod"
- "go.sum"
- ".github/workflows/buf-pr.yml"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: load Go 1.19 env
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- uses: actions/cache@v3
id: cache-golang
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: echo ${{ steps.cache-golang.outputs.cache-hit }}
- name: init dependance
if: steps.cache-golang.outputs.cache-hit != 'true'
run: make install-tools
- name: generate proto
run: make generate-proto
- name: check if files up to date
run: |
if [[ `git status --porcelain` ]]; then
echo "buf gen code not up to date"
exit 1
fi
- name: warming go proxy
if: github.ref == 'refs/heads/main'
run: |
hash=$(git show -s --format=%h)
echo $hash
mkdir ~/warm
cd ~/warm
go mod init warm
go get github.com/hduhelp/api_open_sdk@$hash
GOPROXY=https://goproxy.io,direct go get github.com/hduhelp/api_open_sdk@$hash
GOPROXY=https://goproxy.cn,direct go get github.com/hduhelp/api_open_sdk@$hash