-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
707 lines (593 loc) · 25.6 KB
/
action.yaml
File metadata and controls
707 lines (593 loc) · 25.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
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
name: 'Syncoor Test'
description: 'Run Ethereum client synchronization tests using syncoor'
author: 'ethpandaops'
branding:
icon: 'activity'
color: 'gray-dark'
inputs:
github-token:
description: 'GitHub token for API access' # You can just provide ${{ secrets.GITHUB_TOKEN }}
required: true
image:
description: 'Docker image for syncoor (e.g., ghcr.io/ethpandaops/syncoor:master). If not provided, will build locally.'
required: false
default: ''
git-ref:
description: 'Git branch or commit hash to build from. Only used when image is not provided. If neither image nor git-ref are provided, builds from current directory or master.'
required: false
default: ''
repository:
description: 'Git repository URL to clone from when using git-ref'
required: false
default: 'https://github.com/ethpandaops/syncoor.git'
run-tests:
description: 'Run tests. Useful for generating report index only. There you can set it to false and run the action again to generate the index.'
required: false
default: 'true'
# Syncoor arguments
ethereum-package:
description: 'Ethereum package repository and version (e.g., github.com/ethpandaops/ethereum-package@main)'
required: false
default: 'github.com/ethpandaops/ethereum-package@main'
check-interval:
description: 'Interval in seconds between sync status checks'
required: false
default: '10s'
run-timeout:
description: 'Timeout for sync operation - will cancel sync and generate report marked as "timeout" if exceeded (exits with code 124, treated as success in CI)'
required: false
default: '60m'
client-logs:
description: 'Output EL and CL client logs to stdout'
required: false
default: 'false'
el-client:
description: 'Execution layer client type (geth, besu, nethermind, erigon, reth)'
required: false
default: 'geth'
cl-client:
description: 'Consensus layer client type (lighthouse, teku, prysm, nimbus, lodestar, grandine)'
required: false
default: 'teku'
el-image:
description: 'Execution layer client image (optional)'
required: false
default: ''
cl-image:
description: 'Consensus layer client image (optional)'
required: false
default: ''
el-extra-args:
description: 'Extra arguments for execution layer client (array of strings). Example: ["--some-arg", "--another-arg"]'
required: false
default: '[]'
cl-extra-args:
description: 'Extra arguments for consensus layer client (array of strings). Example: ["--some-arg", "--another-arg"]'
required: false
default: '[]'
el-env-vars:
description: 'Environment variables for execution layer client (array of strings). Example: ["KEY1=value1", "KEY2=value2"]'
required: false
default: '[]'
cl-env-vars:
description: 'Environment variables for consensus layer client (array of strings). Example: ["KEY1=value1", "KEY2=value2"]'
required: false
default: '[]'
network:
description: 'Network to connect to (e.g., hoodi, sepolia, mainnet)'
required: false
default: 'hoodi'
enclave:
description: 'Enclave name (optional - defaults to "sync-test"'
required: false
default: 'sync-test'
log-level:
description: 'Log level (panic, fatal, error, warn, info, debug, trace)'
required: false
default: 'info'
log-force-colors:
description: 'Force colored output in logs'
required: false
default: 'false'
labels:
description: 'Comma-separated labels in key=value format (e.g., "test=sync,env=ci")'
required: false
default: ''
server:
description: 'Centralized server URL (e.g., https://api.syncoor.example)'
required: false
default: ''
server-auth:
description: 'Bearer token for server authentication'
required: false
default: ''
# Metrics exporter configuration
metrics-exporter-image:
description: 'Docker image for metrics exporter (e.g., ethpandaops/ethereum-metrics-exporter:debian-latest)'
required: false
default: 'ethpandaops/ethereum-metrics-exporter:debian-latest'
metrics-exporter-port:
description: 'Port for metrics exporter'
required: false
default: '9090'
metrics-exporter-log-level:
description: 'Log level for metrics exporter (panic, fatal, error, warn, info, debug, trace)'
required: false
default: 'info'
# Ethereum network configuration
supernode:
description: 'Enable supernode (should only be used with peerdas)'
required: false
default: 'false'
checkpoint-sync-enabled:
description: 'Enable checkpoint sync across the network'
required: false
default: 'true'
checkpoint-sync-url:
description: 'Checkpoint sync URL (e.g., https://checkpoint-sync.sepolia.ethpandaops.io/)'
required: false
default: ''
# Public port configuration
public:
description: 'Enable public port publishing'
required: false
default: 'false'
public-port-el:
description: 'Public port for execution layer client'
required: false
default: '40000'
public-port-cl:
description: 'Public port for consensus layer client'
required: false
default: '41000'
public-ip:
description: 'Public IP for port publishing (default: auto)'
required: false
default: 'auto'
# Client log levels
log-level-el:
description: 'Log level for execution layer client (trace, debug, info, warn, error)'
required: false
default: 'info'
log-level-cl:
description: 'Log level for consensus layer client (trace, debug, info, warn, error)'
required: false
default: 'info'
# Github artifacts upload
upload-artifacts:
description: 'Whether to upload test reports as artifacts'
required: false
default: 'true'
artifact-retention-days-test-report:
description: 'Number of days to retain test report artifacts'
required: false
default: '30'
artifact-retention-days-enclave-dump:
description: 'Number of days to retain enclave dump artifacts'
required: false
default: '7'
## S3 upload using rclone
s3-upload:
description: 'Upload test results to S3'
required: false
default: 'false'
s3-bucket:
description: 'S3 bucket name'
required: false
s3-path:
description: 'Path prefix in S3 bucket'
required: false
default: ''
s3-index-generate:
description: 'Generate index.json file in S3 bucket after test run'
required: false
default: 'false'
rclone-config:
description: 'Rclone config file'
required: false
default: '' # Should be base64 encoded. Example: base64 -w 0 rclone.conf
rclone-version:
description: 'Rclone version to use'
required: false
default: 'latest'
kurtosis-version:
description: 'Kurtosis CLI version to use'
required: false
default: '1.18.1'
outputs:
report-path:
description: 'Path to the generated report'
value: ${{ steps.run-test.outputs.report-path }}
main-report-file:
description: 'Name of the main report JSON file (without .json extension)'
value: ${{ steps.run-test.outputs.main-report-file }}
runs:
using: 'composite'
steps:
- name: Verify and install dependencies
if: ${{ inputs.run-tests == 'true' }}
uses: ethpandaops/syncoor/.github/actions/dependencies@59851f7b3da04e649e1d92e03684aae7db6accd5
with:
kurtosis-version: ${{ inputs.kurtosis-version }}
- name: Build Syncoor Docker image locally
if: inputs.image == ''
shell: bash
run: |
# Determine git ref to use
GIT_REF="${{ inputs.git-ref }}"
if [ -z "$GIT_REF" ]; then
GIT_REF="master"
fi
# Clone from specified git ref (defaults to master)
echo "Cloning repository from ${{ inputs.repository }} at ref $GIT_REF"
git clone ${{ inputs.repository }} syncoor-build
cd syncoor-build
git checkout $GIT_REF
# Build the Docker image
echo "Building Docker image..."
docker build -t syncoor:local --build-arg KURTOSIS_VERSION=${{ inputs.kurtosis-version }} .
cd ..
# Clean up
rm -rf syncoor-build
- name: Setup Rclone for S3 upload
if: ${{ inputs.s3-upload == 'true' }}
uses: AnimMouse/setup-rclone@26ef2133e09fd383329a1d4c1fbe6a71db1976c9 # v1.12.0
with:
rclone_config: ${{ inputs.rclone-config }}
version: ${{ inputs.rclone-version }}
- name: Check S3 connectivity before running test
if: ${{ inputs.s3-upload == 'true' }}
shell: bash
run: |
rclone touch s3:${{ inputs.s3-bucket }}/${{ inputs.s3-path }}/healthcheck.txt
- name: Make sure kurtosis engine is started
if: ${{ inputs.run-tests == 'true' }}
id: engine-start
shell: bash
run: |
docker rm kurtosis-github-auth-storage-creator >/dev/null 2>&1 || true # sometimes kurtosis complains about this container
docker rm kurtosis-docker-config-storage-creator >/dev/null 2>&1 || true # sometimes kurtosis complains about this container
kurtosis engine start
kurtosis engine status
- name: Cleanup kurtosis enclaves and resources. We want a clean slate.
if: ${{ inputs.run-tests == 'true' }}
shell: bash
run: |
kurtosis clean -a
rm -rf ${{ runner.temp }}/tmp_results
rm -rf ${{ runner.temp }}/reports
rm -rf ${{ runner.temp }}/kurtosis-enclave-dump
rm -rf ${{ runner.temp }}/*.dump.zip
- name: Cleanup any existing named containers
shell: bash
run: |
# List of named containers that might exist from previous runs
CONTAINERS=("syncoor-run" "syncoor-index" "syncoor-md", "syncoor-metrics-exporter")
for container in "${CONTAINERS[@]}"; do
if docker ps -a --format '{{.Names}}' | grep -q "^${container}$"; then
echo "Stopping and removing existing container: ${container}"
docker stop "${container}" >/dev/null 2>&1 || true
docker rm "${container}" >/dev/null 2>&1 || true
else
echo "Container ${container} does not exist, skipping cleanup"
fi
done
- name: Determine which image to use
id: determine-image
shell: bash
run: |
# Use provided image if specified, otherwise default to local build
if [ -n "${{ inputs.image }}" ]; then
IMAGE="${{ inputs.image }}"
echo "Using provided Docker image: ${IMAGE}"
else
IMAGE="syncoor:local"
echo "No image specified, will build locally: ${IMAGE}"
fi
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
# Validate that we have an image
if [ -z "$IMAGE" ]; then
echo "ERROR: Docker image not specified"
echo "Git ref: '${{ inputs.git-ref }}'"
echo "Input image: '${{ inputs.image }}'"
exit 1
fi
# Pull the image if it's not a local build
if [ "$IMAGE" != "syncoor:local" ]; then
echo "Pulling Docker image: ${IMAGE}"
docker pull "${IMAGE}" || {
echo "Failed to pull Docker image: ${IMAGE}"
exit 1
}
fi
- name: Get Job ID from GH API
if: ${{ inputs.run-tests == 'true' }}
id: get-job-id
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: |
jobs=$(gh api -F per_page=100 -X GET repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs)
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}" and .status=="in_progress") | .id')
echo "job_id=${job_id}" >> "$GITHUB_OUTPUT"
- name: Run Syncoor test
if: ${{ inputs.run-tests == 'true' }}
id: run-test
shell: bash
run: |
mkdir -p ${{ runner.temp }}/reports
echo "Created reports directory at ${{ runner.temp }}/reports"
IMAGE="${{ steps.determine-image.outputs.image }}"
echo "Running syncoor test with Docker image: ${IMAGE}"
# Build docker run command
DOCKER_CMD="docker run --network=host --rm --name=syncoor-run"
# Add Docker socket mount for Kurtosis
DOCKER_CMD="$DOCKER_CMD -v /var/run/docker.sock:/var/run/docker.sock"
# Mount report directory
DOCKER_CMD="$DOCKER_CMD -v ${{ runner.temp }}/reports:/app/reports"
# Mount temp directory (for metrics exporter config file)
DOCKER_CMD="$DOCKER_CMD -v /tmp:/tmp"
# Add the image
DOCKER_CMD="$DOCKER_CMD $IMAGE"
# Use 'sync' command
DOCKER_CMD="$DOCKER_CMD sync"
# Add CLI flags
DOCKER_CMD="$DOCKER_CMD --ethereum-package=${{ inputs.ethereum-package }}"
DOCKER_CMD="$DOCKER_CMD --check-interval=${{ inputs.check-interval }}"
DOCKER_CMD="$DOCKER_CMD --run-timeout=${{ inputs.run-timeout }}"
DOCKER_CMD="$DOCKER_CMD --el-client=${{ inputs.el-client }}"
DOCKER_CMD="$DOCKER_CMD --cl-client=${{ inputs.cl-client }}"
DOCKER_CMD="$DOCKER_CMD --network=${{ inputs.network }}"
DOCKER_CMD="$DOCKER_CMD --report-dir=/app/reports"
DOCKER_CMD="$DOCKER_CMD --log-level=${{ inputs.log-level }}"
DOCKER_CMD="$DOCKER_CMD --enclave=${{ inputs.enclave }}"
DOCKER_CMD="$DOCKER_CMD --log-force-colors=${{ inputs.log-force-colors }}"
DOCKER_CMD="$DOCKER_CMD --client-logs=${{ inputs.client-logs }}"
# Add optional parameters if provided
if [ -n "${{ inputs.el-image }}" ]; then
DOCKER_CMD="$DOCKER_CMD --el-image=${{ inputs.el-image }}"
fi
if [ -n "${{ inputs.cl-image }}" ]; then
DOCKER_CMD="$DOCKER_CMD --cl-image=${{ inputs.cl-image }}"
fi
# Handle el-extra-args array
if [ "${{ inputs.el-extra-args }}" != "[]" ] && [ -n "${{ inputs.el-extra-args }}" ]; then
# Parse JSON array and add each item as a separate --el-extra-args flag
for arg in $(echo '${{ inputs.el-extra-args }}' | jq -r '.[]'); do
if [ -n "$arg" ]; then
DOCKER_CMD="$DOCKER_CMD --el-extra-args=\"$arg\""
fi
done
fi
# Handle cl-extra-args array
if [ "${{ inputs.cl-extra-args }}" != "[]" ] && [ -n "${{ inputs.cl-extra-args }}" ]; then
# Parse JSON array and add each item as a separate --cl-extra-args flag
for arg in $(echo '${{ inputs.cl-extra-args }}' | jq -r '.[]'); do
if [ -n "$arg" ]; then
DOCKER_CMD="$DOCKER_CMD --cl-extra-args=\"$arg\""
fi
done
fi
# Handle el-env-vars array
if [ "${{ inputs.el-env-vars }}" != "[]" ] && [ -n "${{ inputs.el-env-vars }}" ]; then
# Parse JSON array and add each item as a separate --el-env-vars flag
for env_var in $(echo '${{ inputs.el-env-vars }}' | jq -r '.[]'); do
if [ -n "$env_var" ]; then
DOCKER_CMD="$DOCKER_CMD --el-env-vars=\"$env_var\""
fi
done
fi
# Handle cl-env-vars array
if [ "${{ inputs.cl-env-vars }}" != "[]" ] && [ -n "${{ inputs.cl-env-vars }}" ]; then
# Parse JSON array and add each item as a separate --cl-env-vars flag
for env_var in $(echo '${{ inputs.cl-env-vars }}' | jq -r '.[]'); do
if [ -n "$env_var" ]; then
DOCKER_CMD="$DOCKER_CMD --cl-env-vars=\"$env_var\""
fi
done
fi
# Add GitHub Actions context labels for traceability
DOCKER_CMD="$DOCKER_CMD --label=github.run_id=${{ github.run_id }}"
DOCKER_CMD="$DOCKER_CMD --label=github.run_number=${{ github.run_number }}"
DOCKER_CMD="$DOCKER_CMD --label=github.job=${{ github.job }}"
DOCKER_CMD="$DOCKER_CMD --label=github.job_id=${{ steps.get-job-id.outputs.job_id }}"
DOCKER_CMD="$DOCKER_CMD --label=github.repository=${{ github.repository }}"
DOCKER_CMD="$DOCKER_CMD --label=github.workflow=\"${{ github.workflow }}\""
DOCKER_CMD="$DOCKER_CMD --label=github.sha=${{ github.sha }}"
DOCKER_CMD="$DOCKER_CMD --label=github.actor=${{ github.actor }}"
DOCKER_CMD="$DOCKER_CMD --label=github.event_name=${{ github.event_name }}"
DOCKER_CMD="$DOCKER_CMD --label=github.ref=${{ github.ref }}"
# Add user-provided labels if provided
if [ -n "${{ inputs.labels }}" ]; then
IFS=',' read -ra LABEL_ARRAY <<< "${{ inputs.labels }}"
for label in "${LABEL_ARRAY[@]}"; do
DOCKER_CMD="$DOCKER_CMD --label=$label"
done
fi
# Add server parameters if provided
if [ -n "${{ inputs.server }}" ]; then
DOCKER_CMD="$DOCKER_CMD --server=\"${{ inputs.server }}\""
fi
if [ -n "${{ inputs.server-auth }}" ]; then
DOCKER_CMD="$DOCKER_CMD --server-auth=\"${{ inputs.server-auth }}\""
fi
# Add Ethereum network configuration parameters
if [ "${{ inputs.supernode }}" = "true" ]; then
DOCKER_CMD="$DOCKER_CMD --supernode"
fi
if [ "${{ inputs.checkpoint-sync-enabled }}" = "true" ]; then
DOCKER_CMD="$DOCKER_CMD --checkpoint-sync-enabled"
else
DOCKER_CMD="$DOCKER_CMD --checkpoint-sync-enabled=false"
fi
if [ -n "${{ inputs.checkpoint-sync-url }}" ]; then
DOCKER_CMD="$DOCKER_CMD --checkpoint-sync-url=\"${{ inputs.checkpoint-sync-url }}\""
fi
# Add public port configuration parameters
if [ "${{ inputs.public }}" = "true" ]; then
DOCKER_CMD="$DOCKER_CMD --public"
DOCKER_CMD="$DOCKER_CMD --public-port-el=${{ inputs.public-port-el }}"
DOCKER_CMD="$DOCKER_CMD --public-port-cl=${{ inputs.public-port-cl }}"
DOCKER_CMD="$DOCKER_CMD --public-ip=\"${{ inputs.public-ip }}\""
fi
# Add metrics exporter configuration parameters
DOCKER_CMD="$DOCKER_CMD --metrics-exporter-image=${{ inputs.metrics-exporter-image }}"
DOCKER_CMD="$DOCKER_CMD --metrics-exporter-port=${{ inputs.metrics-exporter-port }}"
DOCKER_CMD="$DOCKER_CMD --metrics-exporter-log-level=${{ inputs.metrics-exporter-log-level }}"
# Add client log level parameters
DOCKER_CMD="$DOCKER_CMD --log-level-el=${{ inputs.log-level-el }}"
DOCKER_CMD="$DOCKER_CMD --log-level-cl=${{ inputs.log-level-cl }}"
# Execute the command
echo "Running: $DOCKER_CMD"
set +e # Disable exit on error so we can handle the exit code ourselves
eval $DOCKER_CMD &
wait $!
DOCKER_EXIT_CODE=$?
set -e # Re-enable exit on error for the rest of the script
# Find the generated main.json file (may not exist if test was interrupted)
MAIN_JSON_FILE=""
if [ -d "${{ runner.temp }}/reports" ]; then
MAIN_JSON_PATH=$(find ${{ runner.temp }}/reports -name "*.main.json" -type f | head -1)
if [ -n "$MAIN_JSON_PATH" ]; then
MAIN_JSON_FILE=$(basename "$MAIN_JSON_PATH" .json)
fi
fi
# Set outputs (always set report-path, main-report-file may be empty)
echo "report-path=${{ runner.temp }}/reports" >> $GITHUB_OUTPUT
echo "main-report-file=$MAIN_JSON_FILE" >> $GITHUB_OUTPUT
# Handle exit codes appropriately
if [ $DOCKER_EXIT_CODE -eq 0 ]; then
echo "✅ Syncoor test completed successfully"
exit 0
elif [ $DOCKER_EXIT_CODE -eq 124 ]; then
echo "⏰ Syncoor test timed out (exit code 124) - this is acceptable for CI"
echo "The test will be marked as successful since timeout is expected behavior"
exit 0
elif [ $DOCKER_EXIT_CODE -eq 125 ]; then
echo "💥 Syncoor test failed due to container crash (exit code 125) - this is acceptable for CI"
echo "The test will be marked as successful since container crash produces a valid report"
exit 0
else
echo "❌ Syncoor test failed with exit code $DOCKER_EXIT_CODE"
echo "This indicates an actual error that should fail the CI job"
exit $DOCKER_EXIT_CODE
fi
- name: Upload results to S3
if: ${{ inputs.s3-upload == 'true' && inputs.run-tests == 'true' }}
shell: bash
run: |
rclone copy --no-traverse ${{ runner.temp }}/reports s3:${{ inputs.s3-bucket }}/${{ inputs.s3-path }}
- name: Generate report index and upload to S3
if: ${{ inputs.s3-upload == 'true' && inputs.s3-index-generate == 'true' }}
shell: bash
run: |
mkdir -p ${{ runner.temp }}/tmp_results
echo "Created tmp_results directory at ${{ runner.temp }}/tmp_results"
echo "Fetching results from S3"
rclone copy --progress --transfers=100 --include "*.main.json" s3://${{ inputs.s3-bucket }}/${{ inputs.s3-path }} ${{ runner.temp }}/tmp_results
IMAGE="${{ steps.determine-image.outputs.image }}"
echo "Using Docker image for report index generation: ${IMAGE}"
# Build docker run command
DOCKER_CMD="docker run --rm --name=syncoor-index"
# Mount report directory
DOCKER_CMD="$DOCKER_CMD -v ${{ runner.temp }}/tmp_results:/app/reports"
# Add the image
DOCKER_CMD="$DOCKER_CMD $IMAGE"
# Use 'report-index' command
DOCKER_CMD="$DOCKER_CMD report-index --report-dir /app/reports --output /app/reports/index.json"
# Execute the command
echo "Running: $DOCKER_CMD"
eval $DOCKER_CMD &
wait $!
echo "Upload index.json file to S3"
rclone copy ${{ runner.temp }}/tmp_results/index.json s3:${{ inputs.s3-bucket }}/${{ inputs.s3-path }}/
- name: Upload test reports
uses: actions/upload-artifact@v7
if: always() && inputs.upload-artifacts == 'true' && inputs.run-tests == 'true'
with:
name: ${{ inputs.network }}-${{ inputs.el-client }}-${{ inputs.cl-client }}-report-${{ steps.get-job-id.outputs.job_id }}
path: ${{ runner.temp }}/reports
retention-days: ${{ inputs.artifact-retention-days-test-report }}
- name: Get kurtosis enclave dump
if: always() && inputs.upload-artifacts == 'true' && inputs.run-tests == 'true'
id: enclave-dump
shell: bash
run: |
set +e # Disable exit on error to handle the exit code ourselves
kurtosis enclave dump ${{ inputs.enclave }} ${{ runner.temp }}/kurtosis-enclave-dump
DUMP_EXIT_CODE=$?
set -e # Re-enable exit on error
if [ $DUMP_EXIT_CODE -eq 0 ] && [ -d "${{ runner.temp }}/kurtosis-enclave-dump" ]; then
echo "dump_created=true" >> $GITHUB_OUTPUT
echo "✅ Kurtosis enclave dump created successfully"
else
echo "dump_created=false" >> $GITHUB_OUTPUT
echo "❌ Failed to create kurtosis enclave dump (exit code: $DUMP_EXIT_CODE)"
fi
- name: Upload enclave dump as github artifact
uses: actions/upload-artifact@v7
if: steps.enclave-dump.outputs.dump_created == 'true'
with:
name: ${{ inputs.network }}-${{ inputs.el-client }}-${{ inputs.cl-client }}-kurtosis-dump-${{ steps.get-job-id.outputs.job_id }}
path: ${{ runner.temp }}/kurtosis-enclave-dump
retention-days: ${{ inputs.artifact-retention-days-enclave-dump }}
- name: Upload enclave dump to S3
if: >
inputs.s3-upload == 'true' &&
steps.enclave-dump.outputs.dump_created == 'true' &&
steps.run-test.outputs.main-report-file != '' &&
steps.run-test.outputs.main-report-file != null
shell: bash
run: |
echo "Uploading enclave dump to S3"
set -x
filename="${{ steps.run-test.outputs.main-report-file }}.dump.zip"
cd ${{ runner.temp }}/kurtosis-enclave-dump
zip -r ../$filename .
cd ..
rclone copy $filename s3:${{ inputs.s3-bucket }}/${{ inputs.s3-path }}/
- name: Generate report markdown for Github Actions summary
if: steps.run-test.outputs.main-report-file != '' && steps.run-test.outputs.main-report-file != null
shell: bash
run: |
IMAGE="${{ steps.determine-image.outputs.image }}"
echo "Using Docker image for markdown generation: ${IMAGE}"
# Build docker run command
DOCKER_CMD="docker run --rm --name=syncoor-md"
# Mount report file
DOCKER_CMD="$DOCKER_CMD -v ${{ runner.temp }}/reports:/app/reports"
# Add the image
DOCKER_CMD="$DOCKER_CMD $IMAGE"
# Use 'report-to-md' command
DOCKER_CMD="$DOCKER_CMD report-to-md"
DOCKER_CMD="$DOCKER_CMD --input /app/reports/${{ steps.run-test.outputs.main-report-file }}.json"
DOCKER_CMD="$DOCKER_CMD --output /app/reports/${{ steps.run-test.outputs.main-report-file }}.md"
# Execute the command
echo "Running: $DOCKER_CMD"
eval $DOCKER_CMD &
wait $!
- name: Create GitHub Actions summary
# TODO: update to latest version once the fix in here is merged: https://github.com/Ma11hewThomas/github-markdown-builder/pull/20
uses: skylenet/github-markdown-builder@260b47837207cf26b62f8fea225036a87cb94a12
if: steps.run-test.outputs.main-report-file != '' && steps.run-test.outputs.main-report-file != null
with:
template-file-path: '${{ runner.temp }}/reports/${{ steps.run-test.outputs.main-report-file }}.md'
summary: "true"
pull-request: "false"
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
- name: Cleanup
shell: bash
if: always()
run: |
echo "Cleaning up"
set -x
rm -rf ${{ runner.temp }}/tmp_results
rm -rf ${{ runner.temp }}/reports
rm -rf ${{ runner.temp }}/kurtosis-enclave-dump
rm -rf ${{ runner.temp }}/*.dump.zip
docker rm -f syncoor-run
docker rm -f syncoor-index
docker rm -f syncoor-md
docker rm -f syncoor-metrics-exporter || true
kurtosis clean -a || true