-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (83 loc) · 2.46 KB
/
buf.yaml
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
77
78
79
80
81
82
83
84
85
86
name: buf
on:
pull_request:
branches:
- "main"
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: bufbuild/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: bufbuild/buf-lint-action@v1
verify_formatting:
name: verify_formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: bufbuild/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify the code pushed in formatted
run: |
buf format -w
if git diff --quiet --exit-code ; then
echo "Code is formatted!";
exit 0
else
echo "Code isn't formatted!";
exit 1
fi
verify_compiled_code:
name: verify_compiled_code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: bufbuild/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: verify generated code is not altered
run: |
BIN="/usr/local/bin" && \
VERSION="1.18.0" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"
buf generate -o verify_compiled_code
if diff -qr gen verify_compiled_code/gen ; then
echo "generated code is valid";
else
echo "There seem to be some extra/missing generated files!";
exit 1
fi
rm -rf verify_compiled_code/
buf generate
if git diff --quiet --exit-code ; then
echo "Unaltered code has been pushed";
else
echo "Code pushed seems to be altered";
exit 1
fi
breaking_action:
name: breaking_action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: bufbuild/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: bufbuild/buf-breaking-action@v1
with:
against: "https://github.com/goakshit/buf.git#branch=main"