-
Notifications
You must be signed in to change notification settings - Fork 118
277 lines (265 loc) · 8.7 KB
/
hypersdk-ci.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
name: HyperSDK CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
go-mod-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
- shell: bash
run: go mod tidy
- shell: bash
working-directory: ./examples/morpheusvm
run: go mod tidy
- shell: bash
run: git diff
- shell: bash
run: scripts/tests.clean.sh
hypersdk-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
- name: Run static analysis tests
shell: bash
run: scripts/lint.sh
- name: Run shellcheck
shell: bash
run: scripts/tests.shellcheck.sh
- name: Run actionlint
shell: bash
run: scripts/tests.actionlint.sh
hypersdk-unit-tests:
runs-on: ubuntu-20.04-32
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
- name: Install Rust
uses: ./.github/actions/install-rust
with:
targets: wasm32-unknown-unknown
cache: false
- name: Run unit tests
shell: bash
run: scripts/tests.unit.sh
hypersdk-benchmark-tests:
runs-on: ubuntu-20.04-32
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
- name: Install Rust
uses: ./.github/actions/install-rust
with:
targets: wasm32-unknown-unknown
cache: false
- name: Run unit tests
shell: bash
run: scripts/tests.benchmark.sh
hypersdk-tests:
runs-on: ubuntu-latest
needs: [go-mod-tidy, hypersdk-lint, hypersdk-unit-tests]
outputs:
only_contracts_changed: ${{ steps.check_changes.outputs.only_contracts_changed }}
steps:
- name: Finished HyperSDK tests
run: echo "Finished HyperSDK tests"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check changes
id: check_changes
run: |
diff=$(git diff --name-only HEAD origin/main)
printf "diff:\n%s\n" "$diff"
output=$(echo "$diff" | grep -v '^x/contracts/' | grep -v '^Cargo.toml$' || true)
if [ -n "$diff" ] && [ -z "$output" ]; then
echo "only x/contracts changed, will skip unafected tests"
echo "only_contracts_changed=true" >> "$GITHUB_OUTPUT"
else
echo "cannot skip tests"
echo "only_contracts_changed=false" >> "$GITHUB_OUTPUT"
fi
# MorpheusVM
morpheusvm-lint:
needs: [hypersdk-tests]
if: ${{ needs.hypersdk-tests.outputs.only_contracts_changed != 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
with:
cache-dependency-path: |
go.sum
examples/morpheusvm/go.sum
- name: Run static analysis tests
working-directory: ./examples/morpheusvm
shell: bash
run: scripts/lint.sh
- name: Build vm, cli
working-directory: ./examples/morpheusvm
shell: bash
run: scripts/build.sh
morpheusvm-unit-tests:
needs: [hypersdk-tests]
if: ${{ needs.hypersdk-tests.outputs.only_contracts_changed != 'true' }}
runs-on: ubuntu-20.04-32
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
with:
cache-dependency-path: |
go.sum
examples/morpheusvm/go.sum
- name: Run unit tests
working-directory: ./examples/morpheusvm
shell: bash
run: scripts/tests.unit.sh
- name: Run integration tests
working-directory: ./examples/morpheusvm
shell: bash
run: scripts/tests.integration.sh
morpheusvm-e2e-tests:
needs: [morpheusvm-lint, morpheusvm-unit-tests]
runs-on: ubuntu-20.04-32
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
with:
cache-dependency-path: |
go.sum
examples/morpheusvm/go.sum
- name: Run e2e tests
working-directory: ./examples/morpheusvm
shell: bash
run: scripts/run.sh
env:
MODE: 'test'
- name: Upload tmpnet network dir
uses: ava-labs/avalanchego/.github/actions/upload-tmpnet-artifact@v1-actions
if: always()
with:
name: morpheusvm-e2e-tmpnet-data
morpheusvm-release:
needs: [morpheusvm-e2e-tests]
# We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328
runs-on: ubuntu-20.04-32
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/vm-release
with:
vm-name: morpheusvm
github-token: ${{ secrets.GITHUB_TOKEN }}
# VMWithContracts
vmwithcontracts-lint:
needs: [hypersdk-tests]
if: ${{ needs.hypersdk-tests.outputs.only_contracts_changed != 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/install-go
with:
cache-dependency-path: |
go.sum
examples/vmwithcontracts/go.sum
- name: Run static analysis tests
working-directory: ./examples/vmwithcontracts
shell: bash
run: scripts/lint.sh
- name: Build vm, cli
working-directory: ./examples/vmwithcontracts
shell: bash
run:
scripts/build.sh
# vmwithcontracts-unit-tests:
# needs: [ hypersdk-tests ]
# if: ${{ needs.hypersdk-tests.outputs.only_contracts_changed != 'true' }}
# runs-on: ubuntu-20.04-32
# timeout-minutes: 10
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Go
# uses: ./.github/actions/install-go
# with:
# cache-dependency-path: |
# go.sum
# examples/vmwithcontracts/go.sum
# - name: Run unit tests
# working-directory: ./examples/vmwithcontracts
# shell: bash
# run: scripts/tests.unit.sh
# - name: Run integration tests
# working-directory: ./examples/vmwithcontracts
# shell: bash
# run: scripts/tests.integration.sh
#
# vmwithcontracts-e2e-tests:
# needs: [ vmwithcontracts-lint, vmwithcontracts-unit-tests ]
# runs-on: ubuntu-20.04-32
# timeout-minutes: 25
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Go
# uses: ./.github/actions/install-go
# with:
# cache-dependency-path: |
# go.sum
# examples/vmwithcontracts/go.sum
# - name: Run e2e tests
# working-directory: ./examples/vmwithcontracts
# shell: bash
# run: scripts/run.sh
# env:
# MODE: 'test'
# - name: Upload tmpnet network dir
# uses: ava-labs/avalanchego/.github/actions/upload-tmpnet-artifact@v1-actions
# if: always()
# with:
# name: vmwithcontracts-e2e-tmpnet-data
#
# vmwithcontracts-release:
# needs: [ vmwithcontracts-e2e-tests ]
# # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328
# runs-on: ubuntu-20.04-32
# permissions:
# contents: write
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: ./.github/actions/vm-release
# with:
# vm-name: vmwithcontracts
# github-token: ${{ secrets.GITHUB_TOKEN }}