-
Notifications
You must be signed in to change notification settings - Fork 53
105 lines (92 loc) · 3.88 KB
/
migration-testing.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
name: Migration Testing
on:
workflow_dispatch:
inputs:
initialNetworkNodeTag:
description: 'Specify initial Network Node image tag'
required: true
default: ''
initialMirrorNodeTag:
description: 'Specify initial Mirror-Node image tag'
required: true
default: ''
initialRelayTag:
description: 'Specify initial Hedera JSON-RPC Relay tag'
required: true
default: ''
targetNetworkNodeTag:
description: 'Specify target Network Node image tag'
required: true
default: ''
targetMirrorNodeTag:
description: 'Specify target Mirror-Node image tag'
required: true
default: ''
targetRelayTag:
description: 'Specify target Hedera JSON-RPC Relay tag'
required: true
default: ''
preMigrationTestTags:
description: 'Specify pre-migration test tags'
required: false
default: '@pre-migration'
postMigrationTestTags:
description: 'Specify post-migration test tags'
required: false
default: '@post-migration'
jobs:
check:
name:
Migration testing (${{ inputs.preMigrationTestTags }}/${{ inputs.postMigrationTestTags }}) with initial N:${{ inputs.initialNetworkNodeTag }}, M:${{ inputs.initialMirrorNodeTag }}, R:${{ inputs.initialRelayTag }} and
target N:${{ inputs.targetNetworkNodeTag }}, M:${{ inputs.targetMirrorNodeTag }}, R:${{ inputs.targetRelayTag }}
runs-on: smart-contracts-linux-large
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: recursive
- name: Use Node.js [20]
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
#cache: npm Disabling this because it causes the workflow to hang and eventually timeout
- name: Create .env file
run: cp local.env .env
- name: Install dependencies
run: npm install
- name: Install Foundry
uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1
with:
version: nightly
- name: Start the local node with N:${{ inputs.initialNetworkNodeTag }}, M:${{ inputs.initialMirrorNodeTag }}, R:${{ inputs.initialRelayTag }}
run: npx hedera start -d --full --network-tag=${{inputs.initialNetworkNodeTag}} --mirror-tag=${{inputs.initialMirrorNodeTag}} --relay-tag=${{inputs.initialRelayTag}}
timeout-minutes: 5
- name: Run pre-migration tests
run: npx hardhat test --grep ${{ inputs.preMigrationTestTags }}
timeout-minutes: 15
- name: Freeze the network
run: |
npx hardhat run scripts/freeze-network-node.js
sleep 30
timeout-minutes: 5
- name: Stop docker containers (network node)
run: docker stop network-node json-rpc-relay json-rpc-relay-ws
timeout-minutes: 5
- name: Run the local node with N:${{ inputs.targetNetworkNodeTag }}, M:${{ inputs.targetMirrorNodeTag }}, R:${{ inputs.targetRelayTag }}
env:
NETWORK_NODE_IMAGE_TAG: ${{inputs.targetNetworkNodeTag}}
MIRROR_IMAGE_TAG: ${{inputs.targetMirrorNodeTag}}
RELAY_IMAGE_TAG: ${{inputs.targetRelayTag}}
NETWORK_NODE_LOGS_ROOT_PATH: ~/.local/share/hedera-local/network-logs/node
run: |
docker compose -f docker-compose-state-migration.yml up -d
sleep 5
working-directory: node_modules/@hashgraph/hedera-local/
timeout-minutes: 5
- name: Run post-migration tests
run: npx hardhat test --grep ${{ inputs.postMigrationTestTags }}
timeout-minutes: 15