-
Notifications
You must be signed in to change notification settings - Fork 5
390 lines (356 loc) · 13.6 KB
/
node.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
name: EOS EVM Node CI
on:
push:
branches:
- main
- release/*
pull_request:
workflow_dispatch:
inputs:
override-leap-dev:
description: Override leap-dev target
type: string
override-leap-dev-prerelease:
type: choice
description: Override leap-dev prelease
options:
- default
- true
- false
override-leap:
description: Override leap target
type: string
override-leap-prerelease:
type: choice
description: Override leap prelease
options:
- default
- true
- false
override-cdt:
description: 'Override cdt target'
type: string
override-cdt-prerelease:
type: choice
description: Override cdt prelease
options:
- default
- true
- false
override-eos-evm-contract:
description: 'Override eos-evm-contract target'
type: string
override-eos-evm-contract-prerelease:
type: choice
description: Override eos-evm-contract prelease
options:
- default
- true
- false
override-eos-evm-miner:
description: 'Override eos-evm-miner target'
type: string
defaults:
run:
shell: bash
jobs:
documentation:
name: Attach Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: 'false'
- name: Attach Documentation
run: cat .github/workflows/node.md >> $GITHUB_STEP_SUMMARY
d:
name: Discover Platforms
runs-on: ubuntu-latest
outputs:
missing-platforms: ${{steps.discover.outputs.missing-platforms}}
p: ${{steps.discover.outputs.platforms}}
steps:
- name: Discover Platforms
id: discover
uses: AntelopeIO/discover-platforms-action@v1
with:
platform-file: .cicd/platforms.json
password: ${{secrets.GITHUB_TOKEN}}
package-name: builders
build-platforms:
name: Build Platforms
needs: d
if: needs.d.outputs.missing-platforms != '[]'
strategy:
fail-fast: false
matrix:
platform: ${{fromJSON(needs.d.outputs.missing-platforms)}}
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}}
versions:
name: Determine Versions
runs-on: ubuntu-latest
outputs:
leap-dev-target: ${{steps.versions.outputs.leap-dev-target}}
leap-dev-prerelease: ${{steps.versions.outputs.leap-dev-prerelease}}
leap-target: ${{steps.versions.outputs.leap-target}}
leap-prerelease: ${{steps.versions.outputs.leap-prerelease}}
cdt-target: ${{steps.versions.outputs.cdt-target}}
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}}
eos-evm-contract-target: ${{steps.versions.outputs.eos-evm-contract-target}}
eos-evm-contract-prerelease: ${{steps.versions.outputs.eos-evm-contract-prerelease}}
eos-evm-miner-target: ${{steps.versions.outputs.eos-evm-miner-target}}
steps:
- name: Setup versions from input or defaults
id: versions
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo leap-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".target') >> $GITHUB_OUTPUT
echo leap-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".prerelease') >> $GITHUB_OUTPUT
echo leap-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap".target') >> $GITHUB_OUTPUT
echo leap-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap".prerelease') >> $GITHUB_OUTPUT
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".target') >> $GITHUB_OUTPUT
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".prerelease') >> $GITHUB_OUTPUT
echo eos-evm-contract-target=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".target') >> $GITHUB_OUTPUT
echo eos-evm-contract-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".prerelease') >> $GITHUB_OUTPUT
echo eos-evm-miner-target=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-miner".target') >> $GITHUB_OUTPUT
if [[ "${{inputs.override-leap-dev}}" != "" ]]; then
echo leap-dev-target=${{inputs.override-leap-dev}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-dev-prerelease}}" == +(true|false) ]]; then
echo leap-dev-prerelease=${{inputs.override-leap-dev-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap}}" != "" ]]; then
echo leap-target=${{inputs.override-leap}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-prerelease}}" == +(true|false) ]]; then
echo leap-prerelease=${{inputs.override-leap-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt}}" != "" ]]; then
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-eos-evm-contract}}" != "" ]]; then
echo eos-evm-contract-target=${{inputs.override-eos-evm-contract}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-eos-evm-contract-prerelease}}" == +(true|false) ]]; then
echo eos-evm-contract-prerelease=${{inputs.override-eos-evm-contract-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-eos-evm-miner}}" != "" ]]; then
echo eos-evm-miner-target=${{inputs.override-eos-evm-miner}} >> $GITHUB_OUTPUT
fi
build:
name: EOS EVM Node Build
needs: [d, build-platforms, versions]
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped')
strategy:
fail-fast: false
matrix:
platform: [ ubuntu22 ]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
steps:
- name: Update Package Index & Upgrade Packages
run: |
apt-get update
apt-get upgrade -y
apt update
apt upgrade -y
- name: Download leap-dev binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-dev-prerelease)}}
file: 'leap-dev.*(x86_64|amd64).deb'
container-package: experimental-binaries
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download leap binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-prerelease)}}
file: 'leap.*${{matrix.platform}}.*(x86_64|amd64).deb'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Leap
run: |
apt-get install -y ./leap*.deb
- name: Authenticate
id: auth
uses: AntelopeIO/github-app-token-action@v1
with:
app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }}
private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }}
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ steps.auth.outputs.token }}
- name: Build EOS EVM Node
run: .github/workflows/build-node.sh
env:
CC: gcc-11
CXX: g++-11
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build.tar.gz
path: build.tar.gz
integration-test:
name: EOS EVM Integration Tests
needs: [d, build, versions]
if: always() && needs.d.result == 'success' && needs.build.result == 'success' && needs.versions.result == 'success'
strategy:
fail-fast: false
matrix:
platform: [ ubuntu22 ]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
env:
CC: gcc-11
CXX: g++-11
DCMAKE_BUILD_TYPE: 'Release'
steps:
- name: Update Package Index & Upgrade Packages
run: |
apt-get update
apt-get upgrade -y
apt update
apt upgrade -y
- name: Download CDT
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: cdt
target: '${{needs.versions.outputs.cdt-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.cdt-prerelease)}}
file: 'cdt_.*amd64.deb'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install CDT
run: apt-get install -y ./cdt*.deb
- name: Download leap-dev binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-dev-prerelease)}}
file: 'leap-dev.*(x86_64|amd64).deb'
container-package: experimental-binaries
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download leap binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-prerelease)}}
file: 'leap.*${{matrix.platform}}.*(x86_64|amd64).deb'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Leap
run: |
apt-get install -y ./leap*.deb
- name: Link Leap TestHarness Module (fix for v4 of leap)
run: ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness
- name: Download EOS EVM Contract
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: eosnetworkfoundation
repo: eos-evm
target: '${{needs.versions.outputs.eos-evm-contract-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.eos-evm-contract-prerelease)}}
file: 'contract.tar.gz'
artifact-name: contract.test-actions-off.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract EOS EVM Contract
id: evm-contract
run: |
mkdir contract
mv contract.tar.gz contract/
cd contract
tar xvf contract.tar.gz
cd build
echo "EVM_CONTRACT=$(pwd)" >> "$GITHUB_OUTPUT"
- name: Authenticate
id: auth
uses: AntelopeIO/github-app-token-action@v1
with:
app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }}
private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }}
- name: Checkout eos-evm-miner
uses: actions/checkout@v3
with:
repository: eosnetworkfoundation/eos-evm-miner
path: eos-evm-miner
ref: '${{needs.versions.outputs.eos-evm-miner-target}}'
- name: Download EOS EVM Node builddir
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Extract EOS EVM Node builddir
id: evm-node-build
run: |
mkdir eos-evm-node
mv build.tar.gz eos-evm-node/
pushd eos-evm-node
tar xvf build.tar.gz
pushd build
echo "EVM_NODE_BUILD=$(pwd)" >> "$GITHUB_OUTPUT"
popd
- name: Install Test Dependencies
run: |
pip install --upgrade web3
apt install -y wget
wget https://nodejs.org/dist/v18.17.0/node-v18.17.0-linux-x64.tar.xz
tar xvfJ node-v18.17.0-linux-x64.tar.xz
cp -r node-v18.17.0-linux-x64/{bin,include,lib,share} /usr/
node --version
npm --version
- name: Build eos-evm-miner
id: eos-evm-miner-build
run: |
pushd eos-evm-miner
echo "EVM_MINER_ROOT=$(pwd)" >> "$GITHUB_OUTPUT"
npm install
npm run build
popd
- name: Test Leap Integration
run: |
mkdir test_run_root
cd test_run_root
${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }}/tests/nodeos_eos_evm_test.py -v --eos-evm-contract-root ${{ steps.evm-contract.outputs.EVM_CONTRACT }} --eos-evm-build-root ${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }} --use-miner ${{ steps.eos-evm-miner-build.outputs.EVM_MINER_ROOT }}
- name: Prepare Logs
if: failure()
run: |
tar -czf leap-int-test-logs.tar.gz test_run_root/*
- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: leap-int-test-logs.tar.gz
path: leap-int-test-logs.tar.gz