forked from hiero-ledger/hiero-mirror-node
-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (209 loc) · 8.32 KB
/
Copy pathacceptance.yaml
File metadata and controls
239 lines (209 loc) · 8.32 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
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
# SPDX-License-Identifier: Apache-2.0
name: End-to-end Tests
on:
pull_request:
branches:
- "main"
- "release/**"
paths:
- ".github/workflows/acceptance.yaml"
- "test/**"
push:
branches:
- "main"
- "release/**"
workflow_dispatch:
inputs:
branch:
description: "Branch"
required: true
type: string
permissions:
contents: read
defaults:
run:
shell: bash
env:
LC_ALL: C.UTF-8
jobs:
acceptance:
runs-on: hiero-mirror-node-linux-large
strategy:
fail-fast: false
matrix:
stream-type:
- RECORD
- BLOCK
timeout-minutes: 50
env:
BLOCK_NODE_CHART_VERSION: v0.24.2
CONSENSUS_VERSION: v0.69.1
HELM_RELEASE_NAME: mirror-1
SOLO_CLUSTER_NAME: test
SOLO_NAMESPACE: mirror
SOLO_CLUSTER_SETUP_NAMESPACE: solo
SOLO_DEPLOYMENT: solo-deployment
SOLO_VERSION: v0.54.0
permissions:
pull-requests: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || '' }}
- name: Setup Node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
- name: Install Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
with:
version: "4.0.5"
- name: Setup Kind
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
with:
cluster_name: ${{ env.SOLO_CLUSTER_NAME }}
kubectl_version: v1.34.0
version: v0.31.0
- name: Install JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 25
- name: Install Solo CLI via npm
run: npm install -g @hashgraph/solo@${SOLO_VERSION}
- name: Determine base and tag
timeout-minutes: 15
run: |
set -ex
TAG=$(sed -nE 's/^version: (.+)$/\1/p' charts/hedera-mirror/Chart.yaml)
BASE=""
TRIGGERED_BY_TAG=false
if [[ "$TAG" != *SNAPSHOT ]]; then
BASE="v$TAG"
# The dereferenced tag corresponds to the commit the annotated tag refers to
DEREFERENCED_TAG="v${TAG}^{}"
git ls-remote --tags origin "${DEREFERENCED_TAG}" | grep $(git rev-parse HEAD) && TRIGGERED_BY_TAG=true \
|| true
fi
echo "BASE=${BASE}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "TRIGGERED_BY_TAG=${TRIGGERED_BY_TAG}" >> $GITHUB_ENV
if [[ "$TRIGGERED_BY_TAG" == "true" ]]; then
# wait for images becoming ready if it's a tagged commit
for module in grpc importer monitor rest rest-java test web3; do
while ! docker manifest inspect "gcr.io/mirrornode/hedera-mirror-$module:$TAG" >/dev/null 2>&1; do
sleep 10
done
done
fi
- name: Find changed modules
id: changeset
if: env.TRIGGERED_BY_TAG != 'true'
uses: step-security/paths-filter@6eee183b0d2fd101d3f8ee2935c127bca14c5625 # v3.0.5
with:
base: ${{ env.BASE }}
filters: |
grpc:
- 'grpc/**'
importer:
- 'importer/**'
monitor:
- 'monitor/**'
rest:
- 'rest/!(check-state-proof|monitoring)?(/**)'
rest-java:
- 'rest-java/**'
test:
- 'test/**'
web3:
- 'web3/**'
- name: Setup Gradle
if: env.TRIGGERED_BY_TAG != 'true' && steps.changeset.outputs.changes != '[]'
uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v4
- name: Build images
if: env.TRIGGERED_BY_TAG != 'true' && steps.changeset.outputs.changes != '[]'
run: |
set -ex
echo '${{ steps.changeset.outputs.changes }}' | jq -r '.[]' | while read module; do
./gradlew ":${module}:dockerBuild" -x :rest:monitoring:dockerBuild -PimageTag="${TAG}"
kind load docker-image "gcr.io/mirrornode/hedera-mirror-${module}:${TAG}" -n "${SOLO_CLUSTER_NAME}"
done
- name: Setup Solo Cluster
run: |
set -ex
cat <<EOF > mirror.yaml
monitor:
env:
HIERO_MIRROR_MONITOR_HEALTH_RELEASE_FAILWHENINACTIVE: "true"
test:
enabled: true
test:
env:
HIERO_MIRROR_TEST_ACCEPTANCE_FEATURE_CONTRACTCALLLOCALESTIMATE: "true"
HIERO_MIRROR_TEST_ACCEPTANCE_NETWORK: OTHER
HIERO_MIRROR_TEST_ACCEPTANCE_WEB3_OPCODETRACER_ENABLED: "true"
enabled: true
web3:
env:
HIERO_MIRROR_WEB3_OPCODE_TRACER_ENABLED: "true"
EOF
solo init
solo cluster-ref config connect --cluster-ref kind-"${SOLO_CLUSTER_NAME}" \
--context kind-"${SOLO_CLUSTER_NAME}"
solo deployment config create --deployment "${SOLO_DEPLOYMENT}" --namespace "${SOLO_NAMESPACE}"
solo deployment cluster attach --deployment "${SOLO_DEPLOYMENT}" --cluster-ref kind-"${SOLO_CLUSTER_NAME}" \
--num-consensus-nodes 1
solo cluster-ref config setup --cluster-ref kind-"${SOLO_CLUSTER_NAME}"
if [ "${{ matrix.stream-type }}" = "BLOCK" ]; then
cat <<EOF >> mirror.yaml
importer:
env:
HIERO_MIRROR_IMPORTER_BLOCK_NODES_0_HOST: 'block-node-1.${SOLO_NAMESPACE}.svc.cluster.local'
SPRING_PROFILES_ACTIVE: 'blocknode'
EOF
solo block node add --deployment "${SOLO_DEPLOYMENT}" --cluster-ref kind-"${SOLO_CLUSTER_NAME}" \
--chart-version "${BLOCK_NODE_CHART_VERSION}" --release-tag "${CONSENSUS_VERSION}"
fi
solo keys consensus generate --gossip-keys --tls-keys --deployment "${SOLO_DEPLOYMENT}" -i node1
solo consensus network deploy --deployment "${SOLO_DEPLOYMENT}" --release-tag "${CONSENSUS_VERSION}"
solo consensus node setup --deployment "${SOLO_DEPLOYMENT}" -i node1 --release-tag "${CONSENSUS_VERSION}"
solo consensus node start --deployment "${SOLO_DEPLOYMENT}" -i node1
helm dependency update charts/hedera-mirror
solo mirror node add --cluster-ref kind-"${SOLO_CLUSTER_NAME}" --deployment "${SOLO_DEPLOYMENT}" \
-f mirror.yaml --mirror-node-chart-dir ./charts --pinger --enable-ingress
APP_VERSION=$(helm ls -n "${SOLO_NAMESPACE}" -o json \
| jq -r '.[] | select (.chart | test("hedera-mirror-.*")) | .app_version')
echo "Installed hedera-mirror chart version $APP_VERSION"
- name: Run acceptance tests
run: |
helm test "${HELM_RELEASE_NAME}" -n "${SOLO_NAMESPACE}" --logs \
--timeout 20m | tee output_log.txt
- name: Run k6 tests
if: ${{ matrix.stream-type != 'BLOCK' }}
env:
BASE_URL: "http://127.0.0.1:8081"
DEFAULT_DURATION: "3s"
DEFAULT_GRACEFUL_STOP: "1s"
DEFAULT_VUS: 2
uses: ./.github/actions/k6
- name: Show Pod Logs on Failure
continue-on-error: true
if: ${{ failure() }}
run: |
echo "--------------------------------------------------"
echo "Workflow failed. Collecting logs for debugging..."
echo "--------------------------------------------------"
echo "--- Describing all pods in namespace ${SOLO_NAMESPACE} ---"
kubectl describe pods -n "${SOLO_NAMESPACE}" || echo "Could not describe pods"
echo "--- Fetching logs for all pods in namespace ${SOLO_NAMESPACE} ---"
for pod in $(kubectl get pods -n "${SOLO_NAMESPACE}" -o name); do
if [ -n "$pod" ]; then
echo "--- Logs for pod: $pod ---"
kubectl logs "$pod" -n "${SOLO_NAMESPACE}" --all-containers=true --tail=10000 || echo "Could not get logs for pod $pod"
fi
done