-
Notifications
You must be signed in to change notification settings - Fork 26
449 lines (392 loc) · 15.4 KB
/
main_workflow.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
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
name: main_workflow
on:
push:
branches:
- develop
- main
pull_request:
env:
TENDERMINT_IMAGE_VERSION: latest
jobs:
lock_check:
continue-on-error: False
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-12, windows-latest ]
python-version: ["3.10.9"]
timeout-minutes: 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- if: matrix.os != 'windows-latest'
name: Pipenv install requirements and check it can be locked
run: |
pip install pipenv==2023.7.23
pipenv --clear
time pipenv install --verbose --dev --skip-lock
time pipenv run pip install -e .[all]
time pipenv lock
- if: matrix.os == 'windows-latest'
name: Pipenv install requirements and check it can be locked
run: |
choco install ptime
pip install pipenv==2023.7.23
pipenv --clear
ptime pipenv install --verbose --dev --skip-lock
ptime pipenv run pip install -e .[all]
ptime pipenv lock
install_check:
continue-on-error: False
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: ["3.10.9"]
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Check clean installation
run: |
pip install .[all] --no-cache
autonomy --help
copyright_doc_and_dependencies_check:
continue-on-error: False
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10.9"]
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
pip install tomte[tox,cli]==0.2.17
pip install --user --upgrade setuptools
- name: Check copyright headers
run: tomte format-copyright --author valory --author fetchai
- name: License compatibility check
run: tox -e liccheck
- name: Check docs
run: tox -e check-api-docs
# - name: Check doc links
# run: tomte check-doc-links --http-skips http://host.docker.internal:8545 --http-skips http://www.fipa.org/repository/ips.php3 --url-skips "https://gateway.autonolas.tech/ipfs/<hash>," --url-skips "https://github.com/valory-xyz/open-autonomy/trunk/infrastructure" --url-skips "http://host.docker.internal:8545" --url-skips "https://github.com/valory-xyz/open-operator"
- name: Check doc IPFS hashes
run: tox -e check-doc-hashes
- name: Check dependencies
run: tox -e check-dependencies
linter_checks:
continue-on-error: False
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10.9"]
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-go@v3
with:
go-version: "1.17.7"
- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
pip install tomte[tox]==0.2.17
pip install --user --upgrade setuptools
# install Protobuf compiler
wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip
unzip protoc-24.3-linux-x86_64.zip -d protoc
sudo mv protoc/bin/protoc /usr/local/bin/protoc
# install IPFS
sudo apt-get install -y wget
sudo npm install -g markdown-spellcheck
wget -O ./go-ipfs.tar.gz https://github.com/ipfs/kubo/releases/download/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz
tar xvfz go-ipfs.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init
make protolint_install
- name: Check generate protocols
run: tox -e check-generate-all-protocols
- name: Security checks
run: |
tox -e bandit
tox -e safety
- name: Check packages
run: tox -e check-packages
- name: Check hash
run: tox -e check-hash
- name: Code style check
run: |
tox -e black-check
tox -e isort-check
tox -e flake8
tox -e vulture
tox -e darglint
- name: Static type check
run: tox -e mypy
- name: Pylint
run: tox -e pylint
- name: Check spelling
run: tox -e spell-check
- name: AbciApp consistency checks
run: |
tox -e check-abci-docstrings
tox -e check-abciapp-specs
tox -e check-handlers
tox -e check-dialogues
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: "1.17.7"
- run: |
wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
sudo install gitleaks /usr/bin && \
gitleaks detect --report-format json --report-path leak_report -v
test:
continue-on-error: True
needs:
- lock_check
- install_check
- copyright_doc_and_dependencies_check
- linter_checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-12, windows-latest ]
python-version: [ "3.8", "3.9", "3.10.9", "3.11" ]
timeout-minutes: 90
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-go@v3
with:
go-version: "1.17.7"
- if: matrix.os == 'ubuntu-latest'
name: Install dependencies (ubuntu-latest)
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
pip install tomte[tox]==0.2.17
pip install --user --upgrade setuptools
# install Protobuf compiler
wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip
unzip protoc-24.3-linux-x86_64.zip -d protoc
sudo mv protoc/bin/protoc /usr/local/bin/protoc
# install IPFS
sudo apt-get install -y wget
wget -O ./go-ipfs.tar.gz https://github.com/ipfs/kubo/releases/download/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz
tar xvfz go-ipfs.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init
# install Tendermint
wget -O tendermint.tar.gz https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_amd64.tar.gz
tar -xf tendermint.tar.gz
sudo mv tendermint /usr/local/bin/tendermint
# install skaffold
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.39.1/skaffold-linux-amd64 && \
sudo chmod +x skaffold
sudo install skaffold /usr/local/bin/
skaffold --help
# build required images
skaffold build --push=false
skaffold build -p ci --push=false
TM_DEPLOYMENT_PATH="deployments/Dockerfiles/tendermint/"
TM_IMG_NAME="valory/open-autonomy-tendermint"
docker build $TM_DEPLOYMENT_PATH -t $TM_IMG_NAME:0.1.0 -t $TM_IMG_NAME:1.0.0 -t $TM_IMG_NAME:latest
# pull pre-built images
docker pull valory/autonolas-registries:latest
docker pull valory/contracts-amm:latest
docker pull valory/safe-contract-net:latest
docker pull valory/acn-node:latest
docker pull tendermint/tendermint:v0.34.19
docker pull trufflesuite/ganache:beta
- if: matrix.os == 'ubuntu-latest'
name: Framework unit tests ubuntu-latest
run: |
tox -e py${{ matrix.python-version }}-linux -- -m 'not e2e'
- if: matrix.os == 'ubuntu-latest'
name: Packages unit tests ubuntu-latest
run: |
tox -e packages-py${{ matrix.python-version }}-linux -- -m 'not e2e'
- if: matrix.os == 'macos-12'
name: Install dependencies (macos-12)
run: |
pip install tomte[tox]==0.2.17
# brew install protobuf
# brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/72457f0166d5619a83f508f2345b22d0617b5021/Formula/protobuf.rb
wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-osx-x86_64.zip
unzip protoc-24.3-osx-x86_64.zip -d protoc
# install protolint
curl -L -o protolint.tar.gz https://github.com/yoheimuta/protolint/releases/download/v0.50.2/protolint_0.50.2_darwin_amd64.tar.gz
tar -xzvf protolint.tar.gz
sudo mv protolint /usr/local/bin/protolint
sudo chmod +x /usr/local/bin/protolint
# install ipfs
curl -L -o ipfs.tar.gz https://github.com/ipfs/kubo/releases/download/v0.6.0/go-ipfs_v0.6.0_darwin-amd64.tar.gz
tar -xvzf ipfs.tar.gz
cd go-ipfs
sudo ./install.sh
cd ..
rm -rf go-ipfs
ipfs init
# install Tendermint
wget -O tendermint.tar.gz https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_amd64.tar.gz
tar -xf tendermint.tar.gz
sudo mv tendermint /usr/local/bin/tendermint
# install skaffold
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.39.1/skaffold-darwin-amd64 && \
sudo chmod +x skaffold
sudo install skaffold /usr/local/bin/
skaffold --help
- if: matrix.os == 'macos-12'
name: Framework unit tests macos-12
run: |
tox -e py${{ matrix.python-version }}-darwin -- -m 'not e2e'
- if: matrix.os == 'macos-12'
name: Packages unit tests macos-12
run: |
tox -e packages-py${{ matrix.python-version }}-darwin -- -m 'not e2e'
- if: matrix.os == 'windows-latest'
name: Install dependencies (windows-latest)
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
python -m pip install -U pip
echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"
choco source add -n chocolatey -s 'https://chocolatey.org/api/v2/'
choco source enable -n chocolatey
choco install wget -y
choco install protoc --version 24.3
choco install mingw -y
choco install make -y
# to check make was installed
make --version
pip install tomte[tox]==0.2.17
# wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-win64.zip
# unzip protoc-24.3-win64.zip -d protoc
# sudo mv protoc/bin/protoc /usr/local/bin/protoc
# TODO: install protolint
#echo "::set-env name=GOPATH::$(go env GOPATH)"
#echo "::add-path::$(go env GOPATH)/bin"
#make protolint_install_win
# just check protolint runs
#protolint version
# install ipfs
curl -L -o go-ipfs.zip https://github.com/ipfs/kubo/releases/download/v0.6.0/go-ipfs_v0.6.0_windows-amd64.zip
Expand-Archive -Path go-ipfs.zip -DestinationPath ~\Apps\
cp ~\Apps\go-ipfs\ipfs.exe C:\Users\runneradmin\go\bin\
ipfs init
# install Tendermint
curl -L -o tendermint.tar.gz https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_windows_amd64.tar.gz
tar -xvzf tendermint.tar.gz
cp tendermint.exe C:\Users\runneradmin\go\bin\
# install skaffold
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.39.1/skaffold-windows-amd64.exe
cp skaffold C:\Users\runneradmin\go\bin\
skaffold --help
- if: matrix.os == 'windows-latest'
name: Framework unit tests windows-latest
run: |
tox -e py${{ matrix.python-version }}-win -- -m 'not e2e'
- if: matrix.os == 'windows-latest'
name: Packages unit tests windows-latest
run: |
tox -e packages-py${{ matrix.python-version }}-win -- -m 'not e2e'
- if: matrix.os == 'ubuntu-latest'
name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
e2e:
continue-on-error: True
needs:
- lock_check
- install_check
- copyright_doc_and_dependencies_check
- linter_checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10.9" ]
timeout-minutes: 150
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
pip install tomte[tox]==0.2.17
pip install --user --upgrade setuptools
# install Protobuf compiler
wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip
unzip protoc-24.3-linux-x86_64.zip -d protoc
sudo mv protoc/bin/protoc /usr/local/bin/protoc
# install IPFS
sudo apt-get install -y wget
wget -O ./go-ipfs.tar.gz https://dist.ipfs.io/go-ipfs/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz
tar xvfz go-ipfs.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init
# install Tendermint
wget -O tendermint.tar.gz https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_amd64.tar.gz
tar -xf tendermint.tar.gz
sudo mv tendermint /usr/local/bin/tendermint
# install Skaffold needed in order to build the Flask with Tendermint image
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.39.1/skaffold-linux-amd64 &&\
sudo install skaffold /usr/local/bin/
# build the Flask with Tendermint image
TM_DEPLOYMENT_PATH="deployments/Dockerfiles/tendermint/"
TM_IMG_NAME="valory/open-autonomy-tendermint"
docker build $TM_DEPLOYMENT_PATH -t $TM_IMG_NAME:0.1.0 -t $TM_IMG_NAME:1.0.0 -t $TM_IMG_NAME:latest
# pull pre-built images
docker pull valory/autonolas-registries:latest
docker pull valory/contracts-amm:latest
docker pull valory/safe-contract-net:latest
docker pull tendermint/tendermint:v0.34.19
docker pull valory/slow-tendermint-server:0.1.0
- name: Unit tests
run: |
tox --develop -e e2e-py${{ matrix.python-version }}-linux -- -m 'e2e'