forked from hiero-ledger/hiero-mirror-node
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (111 loc) · 4.6 KB
/
Copy pathrosetta.yml
File metadata and controls
130 lines (111 loc) · 4.6 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
# SPDX-License-Identifier: Apache-2.0
name: Rosetta API
on:
schedule:
- cron: "0 1 * * *" # Daily at 1:00 AM
push:
branches:
- "main"
tags:
- "v*"
defaults:
run:
shell: bash
working-directory: ./rosetta
permissions:
contents: read
env:
LC_ALL: C.UTF-8
MODULE: rosetta
NETWORK: previewnet
jobs:
validate:
runs-on: hiero-mirror-node-linux-large
timeout-minutes: 30
env:
ROSETTA_CLI_VERSION: v0.10.4
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
- name: Setup Node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
- name: Set Importer StartDate
run: |
# Set start date to 60 seconds before the first block timestamp in the network
url="https://${NETWORK}.mirrornode.hedera.com/api/v1/blocks?limit=1&order=asc"
firstTimestamp=$(curl -s "${url}" | jq -r .blocks[0].timestamp.from)
if [[ -z "${firstTimestamp}" ]]; then
echo "Unable to get first block timestamp"
exit 1
fi
startSecs=$((${firstTimestamp%.*}-60))
startDate=$(date --date="@${startSecs}" -Iseconds -u | grep -o -e '^[0-9T:-]\+')
startDate="${startDate}Z"
echo "STARTDATE=${startDate}" >> $GITHUB_ENV
echo "Set importer startDate to ${startDate}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
with:
driver-opts: network=host
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["https://hub.mirror.docker.lat.ope.eng.hashgraph.io"]
version: latest
- name: Build Image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
build-args: GIT_REF=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: ./rosetta/container
github-token: ${{ secrets.GITHUB_TOKEN }}
load: true
provenance: false
push: false
tags: "${{ env.MODULE }}:${{ github.sha }}"
- name: Importer Configuration
run: echo "${{ secrets.ROSETTA_IMPORTER_CONFIG }}" | base64 -d > ${{ github.workspace }}/application_importer.yml
- name: Rosetta Configuration
run: echo "${{ secrets.ROSETTA_ROSETTA_CONFIG }}" | base64 -d > ${{ github.workspace }}/application_rosetta.yml
- name: Run Mirror Node in Online Mode
run: |
ONLINE_CONTAINER_ID=$(docker run -d -e HIERO_MIRROR_IMPORTER_STARTDATE=${STARTDATE} \
-e NETWORK=${NETWORK} \
-e HIERO_MIRROR_ROSETTA_RESPONSE_MAXTRANSACTIONSINBLOCK=4 \
-v ${{ github.workspace }}/application_importer.yml:/app/importer/application.yml \
-v ${{ github.workspace }}/application_rosetta.yml:/app/rosetta/application.yml \
-p 5700:5700 "${MODULE}:${{ github.sha }}")
echo "ONLINE_CONTAINER_ID=$ONLINE_CONTAINER_ID" >> $GITHUB_ENV
- name: Wait for Mirror Node to Start Syncing
run: ./scripts/wait-for-mirror-node.sh
env:
MAX_WAIT_SECONDS: 900
- name: Rosetta CLI Configuration
working-directory: ./rosetta/scripts/validation/${{ env.NETWORK }}
run: |
# set start index to genesis index + 1
body='{"network_identifier": {"blockchain": "Hedera", "network": "'${NETWORK}'"}}'
startIndex=$(curl -sL -d "${body}" http://localhost:5700/network/status | jq '.genesis_block_identifier.index+1')
echo "Setting data start_index to $startIndex"
jq --argjson startIndex $startIndex '.data.start_index=$startIndex' validation.json > tmp.json && \
mv tmp.json validation.json
- name: Run Rosetta CLI Validation
working-directory: ./rosetta/scripts/validation
run: ./run-validation.sh ${NETWORK} data
- name: Run Rosetta Postman API Tests
working-directory: ./charts/hedera-mirror-rosetta
run: |
echo "Disabled"
# npm install -g newman
# newman run postman.json
- name: Show Container Log
if: ${{ failure() }}
run: |
echo "Logs for online container ${ONLINE_CONTAINER_ID}"
[[ -n "${ONLINE_CONTAINER_ID}" ]] && docker logs ${ONLINE_CONTAINER_ID} || true