Skip to content

Commit

Permalink
Fix EOF marker indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lschuermann committed Nov 8, 2024
1 parent e5d42dc commit dba557d
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions .github/workflows/treadmill-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,47 +246,50 @@ jobs:
export PYTHONPATH="$PWD:$PYTHONPATH"
# Generate a summary of all the tests executed:
cat <<EOF >>"$GITHUB_STEP_SUMMARY"
cat <<GITHUB_STEP_SUMMARY >>"$GITHUB_STEP_SUMMARY"
### Tests executed on board \`nrf52840dk\`, job ID ${{ matrix.tml-job-id }}
| Result | Test |
|--------|------|
EOF
GITHUB_STEP_SUMMARY
echo "$JSON_TEST_ARRAY" | jq -r -c '.[]' | while read TEST; do
# For markdown links, we want a sanitized test name without special characters
SANITIZED_TEST_NAME="${TEST//[^[:alnum:]]/_}"
# WHILE ---------->
# Prepare a collapsible section in the test output:
cat <<EOF >>"./step-summary-details.txt"
<details>
<summary>Test \`$TEST\`</summary>
##### Test \`$TEST\`
\`\`\`
EOF
# For markdown links, we want a sanitized test name without special characters
SANITIZED_TEST_NAME="${TEST//[^[:alnum:]]/_}"
# Run the test script, saving its output:
echo "===== RUNNING TEST $TEST ====="
FAIL=0
(python3 core/main.py --board boards/nrf52dk.py --test "$TEST" 2>&1 | tee ./job-output.txt) || FAIL=1
# Prepare a collapsible section in the test output:
cat <<STEP_SUMMARY_DETAILS >>"./step-summary-details.txt"
<details>
<summary>Test \`$TEST\`</summary>
##### Test \`$TEST\`
\`\`\`
STEP_SUMMARY_DETAILS
# Insert the result into the markdown table:
if [ "$FAIL" == "0" ]; then
echo "| ✅ | \`$TEST\` ([Output](#test-|" >>"$GITHUB_STEP_SUMMARY"
else
echo "===== Test $TEST failed! ====="
echo "| ❌ | \`$TEST\` |" >>"$GITHUB_STEP_SUMMARY"
fi
# Run the test script, saving its output:
echo "===== RUNNING TEST $TEST ====="
FAIL=0
(python3 core/main.py --board boards/nrf52dk.py --test "$TEST" 2>&1 | tee ./job-output.txt) || FAIL=1
# Sanitize the output (remove triple backslashes) and copy it into the step summary details:
cat ./job-output.txt | sed 's/```//g' >>"./step-summary-details.txt"
# Insert the result into the markdown table:
if [ "$FAIL" == "0" ]; then
echo "| ✅ | \`$TEST\` ([Output](#test-|" >>"$GITHUB_STEP_SUMMARY"
else
echo "===== Test $TEST failed! ====="
echo "| ❌ | \`$TEST\` |" >>"$GITHUB_STEP_SUMMARY"
fi
# Finalize this section of the test output summary:
cat <<EOF >>"./step-summary-details.txt"
\`\`\`
</details>
# Sanitize the output (remove triple backslashes) and copy it into the step summary details:
cat ./job-output.txt | sed 's/```//g' >>"./step-summary-details.txt"
EOF
# Finalize this section of the test output summary:
cat <<STEP_SUMMARY_DETAILS >>"./step-summary-details.txt"
\`\`\`
</details>
STEP_SUMMARY_DETAILS
# -----------> DONE
done
# Finally, add all test output sections to the overall step summary:
Expand Down

0 comments on commit dba557d

Please sign in to comment.