-
Notifications
You must be signed in to change notification settings - Fork 0
238 lines (218 loc) · 9.5 KB
/
node_sync_test.yaml
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
name: Node sync tests
on:
workflow_dispatch:
inputs:
environment:
description: "Environment on which Buildkite agent will run tests"
type: choice
options:
- mainnet
- preprod
- preview
- shelley-qa
default: preprod
build_mode:
description: "build-mode"
type: choice
options:
- nix
default: nix
tag_no1:
description: "Initial sync - Graph axis label"
required: true
default: "9.2.1"
node_rev1:
description: "Initial sync - cardano-node revision"
required: true
default: "tags/9.2.1"
node_topology1:
description: "Initial sync - cardano-node topology"
type: choice
options:
- non-bootstrap-peers
- bootstrap-peers
default: legacy
node_start_arguments1:
description: "Initial sync - Extra arguments when starting the node"
required: false
default: "None"
tag_no2:
description: "Upgrade node - Graph axis label"
required: true
default: "None"
node_rev2:
description: "Upgrade node - cardano-node revision"
required: true
default: "None"
node_topology2:
description: "Upgrade node - cardano-node topology"
type: choice
options:
- legacy
- p2p
default: legacy
node_start_arguments2:
description: "Upgrade node - Extra arguments when starting the node"
required: false
default: "None"
jobs:
node_sync_test_buildkite_mainnet:
runs-on: ubuntu-latest
steps:
- name: Get latest node tag
id: get_tag
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "Using manual input for tag_no1"
echo "node_rev1=${{ github.event.inputs.node_rev1 }}" >> $GITHUB_OUTPUT
else
echo "Fetching latest tag for scheduled run"
# Fetch the latest tag dynamically
node_release_url='https://api.github.com/repos/IntersectMBO/cardano-node/releases/latest'
latest_tag=$(curl -s $node_release_url | jq .tag_name -r)
echo "node_rev1=$latest_tag" >> $GITHUB_OUTPUT
# Fetch more details
latest_name=$(curl -s $node_release_url | jq .name -r)
latest_url=$(curl -s $node_release_url | jq .html_url -r)
latest_archive=$(curl -s $node_release_url | jq .assets[0].browser_download_url -r)
echo "Latest Release Name: $latest_name"
echo "Release URL: $latest_url"
echo "Download Archive URL: $latest_archive"
fi
- name: Trigger the Buildkite pipeline - run sync tests on Mainnet
uses: 'buildkite/trigger-pipeline-action@v1.5.0'
env:
BUILDKITE_API_ACCESS_TOKEN: ${{ secrets.BUILDKITE_API_ACCESS_TOKEN }}
PIPELINE: 'input-output-hk/node-sync-tests'
BRANCH: ${{ github.ref_name }}
MESSAGE: ':github: Triggered by GitHub Action'
AWS_DB_USERNAME: ${{ secrets.AWS_DB_USERNAME }}
AWS_DB_PASS: ${{ secrets.AWS_DB_PASS }}
AWS_DB_NAME: ${{ secrets.AWS_DB_NAME }}
AWS_DB_HOSTNAME: ${{ secrets.AWS_DB_HOSTNAME }}
BLOCKFROST_API_KEY: ${{ secrets.BLOCKFROST_API_KEY }}
BUILD_ENV_VARS: '{
"env":"${{ github.event.inputs.environment }}",
"build_mode":"${{ github.event.inputs.build_mode }}",
"node_rev1":"${{ steps.get_tag.outputs.node_rev1 }}",
"node_rev2":"${{ github.event.inputs.node_rev2 }}",
"tag_no1":"${{ github.event.inputs.tag_no1 }}",
"tag_no2":"${{ github.event.inputs.tag_no2 }}",
"node_topology1":"${{ github.event.inputs.node_topology1 }}",
"node_topology2":"${{ github.event.inputs.node_topology2 }}",
"node_start_arguments1":"${{ github.event.inputs.node_start_arguments1 }}",
"node_start_arguments2":"${{ github.event.inputs.node_start_arguments2 }}",
"BLOCKFROST_API_KEY":"${{ secrets.BLOCKFROST_API_KEY }}",
"AWS_DB_USERNAME":"${{ secrets.AWS_DB_USERNAME }}",
"AWS_DB_PASS":"${{ secrets.AWS_DB_PASS }}",
"AWS_DB_NAME":"${{ secrets.AWS_DB_NAME }}",
"AWS_DB_HOSTNAME":"${{ secrets.AWS_DB_HOSTNAME }}"
}'
node_sync_test:
strategy:
matrix:
env: [ preprod, preview ]
ghc: [ "9.6" ]
cabal: [ "3.12.1.0" ]
sys:
# skip windows for now, we need to check if is really worth the time to make it work
# - { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
- { os: ubuntu-latest, shell: bash }
- { os: macos-latest, shell: bash }
branch:
- ${{ github.ref_name }}
fail-fast: false
runs-on: ${{ matrix.sys.os }}
timeout-minutes: 600
env:
MSYS2_PATH_TYPE: inherit
MSYSTEM: MINGW64
steps:
- name: Install Haskell
if: matrix.sys.os == 'windows-latest'
uses: input-output-hk/actions/haskell@latest
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Install system dependencies
if: matrix.sys.os == 'windows-latest'
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: true
- name: Checkout cardano-sync-tests repository
uses: actions/checkout@v4
with:
path: cardano_sync_tests
ref: ${{ github.ref_name }}
- name: Install nix
uses: cachix/install-nix-action@v27
if: matrix.sys.os != 'windows-latest'
with:
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.nixos.org https://cache.iog.io
allow-import-from-derivation = true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
pip install pymysql
pip install requests
pip install psutil
pip install pandas
pip install blockfrost-python
pip install GitPython
pip install colorama
- name: "[Windows] Update environment variables"
if: runner.os == 'Windows'
shell: pwsh
run: |
"PATH=C:\\msys64\\mingw64\\opt\\cardano\\bin;C:\\msys64\\mingw64\\bin;{0}" -f $env:PATH >> $env:GITHUB_ENV
"PKG_CONFIG_PATH=C:\\msys64\\mingw64\\opt\\cardano\\lib\\pkgconfig;C:\\msys64\\mingw64\\lib\\pkgconfig;C:\\msys64\\mingw64\\share\\pkgconfig;C:\\msys64\\usr\\lib\\pkgconfig;C:\\msys64\\usr\\share\\pkgconfig;{0}" -f $env:PKG_CONFIG_PATH >> $env:GITHUB_ENV
- name: Run sync test on Windows
if: runner.os == 'Windows'
env:
BLOCKFROST_API_KEY: ${{ secrets.BLOCKFROST_API_KEY }}
run: |
cd cardano_sync_tests
echo "current branch: $(git branch --show-current)"
python sync_tests/node_sync_test.py -e ${{ matrix.env }} -b ${{ github.event.inputs.build_mode }} -t1 "${{ github.event.inputs.tag_no1 }}" -t2 "${{ github.event.inputs.tag_no2 }}" -r1 "${{ github.event.inputs.node_rev1 }}" -r2 "${{ github.event.inputs.node_rev2 }}" -n1 "${{ github.event.inputs.node_topology1 }}" -n2 "${{ github.event.inputs.node_topology2 }}" -a1="${{ github.event.inputs.node_start_arguments1 }}" -a2="${{ github.event.inputs.node_start_arguments2 }}"
continue-on-error: true # This will ensure the job does not fail if Windows tests fail - which is expected because they run slower
- name: Run sync test
if: runner.os != 'Windows'
env:
BLOCKFROST_API_KEY: ${{ secrets.BLOCKFROST_API_KEY }}
run: |
cd cardano_sync_tests
echo "current branch: $(git branch --show-current)"
python sync_tests/node_sync_test.py -e ${{ matrix.env }} -b ${{ github.event.inputs.build_mode }} -t1 "${{ github.event.inputs.tag_no1 }}" -t2 "${{ github.event.inputs.tag_no2 }}" -r1 "${{ github.event.inputs.node_rev1 }}" -r2 "${{ github.event.inputs.node_rev2 }}" -n1 "${{ github.event.inputs.node_topology1 }}" -n2 "${{ github.event.inputs.node_topology2 }}" -a1="${{ github.event.inputs.node_start_arguments1 }}" -a2="${{ github.event.inputs.node_start_arguments2 }}"
- name: Write the test results into the database
env:
AWS_DB_USERNAME: ${{ secrets.AWS_DB_USERNAME }}
AWS_DB_PASS: ${{ secrets.AWS_DB_PASS }}
AWS_DB_NAME: ${{ secrets.AWS_DB_NAME }}
AWS_DB_HOSTNAME: ${{ secrets.AWS_DB_HOSTNAME }}
BLOCKFROST_API_KEY: ${{ secrets.BLOCKFROST_API_KEY }}
run: |
cd cardano_sync_tests
echo "current branch: $(git branch --show-current)"
python sync_tests/node_write_sync_values_to_db.py -e ${{ matrix.env }}
- name: Prepare node logs
if: always()
run: |
cd cardano_sync_tests
cp logfile.log node.log
- name: Generate artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: node_logs_${{ matrix.env }}_${{ matrix.sys.os }}
path: |
cardano_sync_tests/node.log
cardano_sync_tests/sync_results.json
cardano_sync_tests/config.json
cardano_sync_tests/topology.json