1+ name : Build
2+ on :
3+ pull_request :
4+ branches : ["**"]
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ install-tools :
11+ if : " !contains(github.event.head_commit.message, 'Merge pull request')"
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v4
15+ - uses : actions/setup-go@v5
16+ with :
17+ go-version-file : ' go.mod'
18+ - name : Install all tools
19+ run : make tools
20+ - uses : actions/upload-artifact@v4
21+ with :
22+ name : tools
23+ path : bin/
24+
25+ tests :
26+ needs : install-tools
27+ if : " !contains(github.event.head_commit.message, 'Merge pull request')"
28+ runs-on : ubuntu-latest
29+ steps :
30+ - uses : actions/checkout@v4
31+ - uses : actions/setup-go@v5
32+ with :
33+ go-version-file : ' go.mod'
34+ - uses : actions/download-artifact@v4
35+ with :
36+ name : tools
37+ path : bin/
38+ - name : Set bin as executable
39+ run : chmod +x bin/*
40+ - name : Run tests
41+ run : make test
42+
43+ lint :
44+ needs : install-tools
45+ if : " !contains(github.event.head_commit.message, 'Merge pull request')"
46+ runs-on : ubuntu-latest
47+ steps :
48+ - uses : actions/checkout@v4
49+ - uses : actions/setup-go@v5
50+ with :
51+ go-version-file : ' go.mod'
52+ - uses : actions/download-artifact@v4
53+ with :
54+ name : tools
55+ path : bin/
56+ - name : Set bin as executable
57+ run : chmod +x bin/*
58+ - name : Run linter
59+ run : make lint
60+
61+ generate :
62+ needs : install-tools
63+ if : " !contains(github.event.head_commit.message, 'Merge pull request')"
64+ runs-on : ubuntu-latest
65+ steps :
66+ - uses : actions/checkout@v4
67+ - uses : actions/setup-go@v5
68+ with :
69+ go-version-file : ' go.mod'
70+ - uses : actions/download-artifact@v4
71+ with :
72+ name : tools
73+ path : bin/
74+ - name : Set bin as executable
75+ run : chmod +x bin/*
76+ - run : go mod download
77+ - name : Run generate
78+ run : make generate
79+ - name : Porcelain
80+ shell : bash
81+ run : |
82+ dirty_files="$(git status --porcelain)"
83+ if [[ `git status --porcelain` ]]; then
84+ echo "The following files are dirty after running generators:"
85+ echo "${dirty_files}"
86+ exit 1
87+ fi
0 commit comments