-
Notifications
You must be signed in to change notification settings - Fork 78
203 lines (178 loc) · 6.76 KB
/
ci.yml
File metadata and controls
203 lines (178 loc) · 6.76 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: ci
on:
pull_request:
merge_group:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
env:
GO_VERSION: "1.24.1" # https://go.dev/dl/
FOUNDRY_VERSION: stable
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8
- name: Install shadow
run: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
- name: Run all the linter tools against code
run: make lint
typos:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- uses: crate-ci/typos@a4c3e43aea0a9e9b9e6578d2731ebd9a27e8f6cd # v1.35.5
gen-doc:
name: Check gen-doc generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: gen-doc
run: make gen-doc
- name: Check if generated files are up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Error: Generated files are not up to date. Please run \`make gen\`."
echo "🚨 If \`make gen\` doesn't update the contract bytecodes and/or go bindings and this job is still failing, please take a look at the ethereum and foundry versions. We don't pin the versions of these packages in CI so this job may complain after an update of the packages!"
git status --porcelain
git diff
exit 1
else
echo "✅ Generated files are up to date."
fi
gen-proto:
name: Check gen-proto generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: gen-proto
run: make gen-proto
- name: Check if generated files are up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Error: Generated files are not up to date. Please run \`make gen\`."
echo "🚨 If \`make gen\` doesn't update the contract bytecodes and/or go bindings and this job is still failing, please take a look at the ethereum and foundry versions. We don't pin the versions of these packages in CI so this job may complain after an update of the packages!"
git status --porcelain
git diff
exit 1
else
echo "✅ Generated files are up to date."
fi
gen-go-bindings:
name: Check gen-go-bindings generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: gen-go-bindings
run: make gen-go-bindings
- name: Check if generated files are up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Error: Generated files are not up to date. Please run \`make gen\`."
echo "🚨 If \`make gen\` doesn't update the contract bytecodes and/or go bindings and this job is still failing, please take a look at the ethereum and foundry versions. We don't pin the versions of these packages in CI so this job may complain after an update of the packages!"
git status --porcelain
git diff
exit 1
else
echo "✅ Generated files are up to date."
fi
gen-load-test-modes:
name: Check gen-load-test-modes generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: gen-load-test-modes
run: make gen-load-test-modes
- name: Check if generated files are up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Error: Generated files are not up to date. Please run \`make gen\`."
echo "🚨 If \`make gen\` doesn't update the contract bytecodes and/or go bindings and this job is still failing, please take a look at the ethereum and foundry versions. We don't pin the versions of these packages in CI so this job may complain after an update of the packages!"
git status --porcelain
git diff
exit 1
else
echo "✅ Generated files are up to date."
fi
gen-json-rpc-types:
name: Check gen-json-rpc-types generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: gen-json-rpc-types
run: make gen-json-rpc-types
- name: Check if generated files are up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Error: Generated files are not up to date. Please run \`make gen\`."
echo "🚨 If \`make gen\` doesn't update the contract bytecodes and/or go bindings and this job is still failing, please take a look at the ethereum and foundry versions. We don't pin the versions of these packages in CI so this job may complain after an update of the packages!"
git status --porcelain
git diff
exit 1
else
echo "✅ Generated files are up to date."
fi
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run tests
run: make test
loadtest:
name: Run loadtest
runs-on: ubuntu-latest
strategy:
matrix:
tool: [geth, anvil]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: Install Geth
run: |
if [ "${{ matrix.tool }}" = "geth" ]; then
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
geth --version
fi
- name: Run loadtest againt ${{ matrix.tool }}
run: |
${{ matrix.tool }} --version
make ${{ matrix.tool }} &
sleep 5
make loadtest
install:
name: Install go package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install dependencies
run: go get
- name: Install polycli using go
run: go install
- name: Check that polycli has been installed
run: polygon-cli version