-
Notifications
You must be signed in to change notification settings - Fork 115
167 lines (157 loc) · 4.66 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
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: 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: 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