forked from LedgerHQ/ledger-live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aggregate-xray-reports.sh
executable file
·35 lines (26 loc) · 1.01 KB
/
aggregate-xray-reports.sh
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
#!/bin/bash
cd apps/ledger-live-desktop/artifacts/xray
# Initialize an empty array for storing test results
aggregated_tests=()
# Iterate through downloaded results files
for file in xray-reports-*/xray-*.json; do
# Check if the file exists
if [ -f "$file" ]; then
# Extract testExecutionKey and tests from the file
test_execution_key=$(jq -r '.testExecutionKey' "$file")
tests=$(jq -c '.tests[]' "$file")
# Set the TEST_EXECUTION_KEY if not already set
[ -z "$TEST_EXECUTION_KEY" ] && export TEST_EXECUTION_KEY=$test_execution_key
# Append tests to the aggregated array
aggregated_tests+=($tests)
fi
done
# Create the final Xray payload
xray_payload='{"testExecutionKey":"'$TEST_EXECUTION_KEY'","info":{},"tests":['
xray_payload+=$(IFS=,; echo "${aggregated_tests[*]}")
xray_payload+=']}'
# Print the content of the aggregated Xray payload
echo "Xray Payload Content:"
echo "$xray_payload"
# Output the aggregated Xray payload to a file
echo "$xray_payload" > aggregated-xray-reports.json