Skip to content

test-dispatch-with-artifacts #15

test-dispatch-with-artifacts

test-dispatch-with-artifacts #15

Workflow file for this run

name: "Home-CI External Test Results Processing"
on:
repository_dispatch:
types: [dispatch-with-artifacts, test-dispatch-with-artifacts]
jobs:
process-test-results:
runs-on: ubuntu-latest
steps:
- name: Install yq
run: |
sudo apt-get update && sudo apt-get install -y python3-pip
pip3 install yq
- name: Display test metadata
run: |
echo "๐Ÿ” Processing test results from home-ci"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
echo "๐Ÿ“ Branch: ${{ github.event.client_payload.branch }}"
echo "๐Ÿ“ Commit: ${{ github.event.client_payload.commit }}"
echo "๐Ÿ“ Success: ${{ github.event.client_payload.success }}"
echo "๐Ÿ“ Source: ${{ github.event.client_payload.source }}"
echo "๐Ÿ“ Timestamp: ${{ github.event.client_payload.timestamp }}"
echo "๐Ÿ“ Artifact: ${{ github.event.client_payload.artifact_name }}"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
- name: Process test logs
run: |
echo "๐Ÿ“‹ Processing test execution logs..."
# Check if artifacts exist and process them
if [ "${{ toJson(github.event.client_payload.artifacts) }}" != "null" ]; then
echo "โœ… Test artifacts found"
# Create artifacts directory
mkdir -p test-artifacts
# List available artifacts
echo "๐Ÿ“ฆ Available artifacts:"
echo '${{ toJson(github.event.client_payload.artifacts) }}' | jq -r 'keys[]' | while read artifact; do
echo " - $artifact"
done
else
echo "โš ๏ธ No artifacts found in payload"
fi
- name: Process e2e test report
if: github.event.client_payload.artifacts
run: |
echo "๐Ÿ“Š Processing e2e test report..."
# Extract YAML e2e report files
echo '${{ toJson(github.event.client_payload.artifacts) }}' | jq -r '
to_entries[] |
select(.key | endswith("-e2e-report.yaml")) |
"REPORT_FILE=\(.key)\nREPORT_CONTENT=\(.value.content)"
' > report_vars.env
if [ -f report_vars.env ] && [ -s report_vars.env ]; then
source report_vars.env
# Decode and save e2e report content
if [ ! -z "$REPORT_CONTENT" ] && [ "$REPORT_CONTENT" != "null" ]; then
echo "$REPORT_CONTENT" | base64 -d > "test-artifacts/$REPORT_FILE"
echo "โœ… Saved e2e report: test-artifacts/$REPORT_FILE"
# Parse and display e2e report information
echo ""
echo "๐Ÿงช E2E Test Report Summary:"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
# Extract general info using yq (if available) or basic grep/awk
if command -v yq >/dev/null 2>&1; then
echo "๐Ÿ“ Test Run Info:"
echo " Start time: $(yq '.test_run.start_time' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Runner: $(yq '.test_run.runner' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " OS: $(yq '.environment.os' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Architecture: $(yq '.environment.arch' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo ""
echo "๐Ÿ Test Summary:"
echo " End time: $(yq '.summary.end_time' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Duration: $(yq '.summary.duration_seconds' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A') seconds"
echo " Overall status: $(yq '.summary.overall_status' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Success rate: $(yq '.summary.success_rate' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Total steps: $(yq '.summary.total_steps' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Passed steps: $(yq '.summary.passed_steps' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo " Failed steps: $(yq '.summary.failed_steps' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo 'N/A')"
echo ""
echo "๐Ÿ“‹ Test Steps:"
yq '.steps[] | " " + .phase + ": " + .status + " (" + .timestamp + ")"' test-artifacts/$REPORT_FILE 2>/dev/null | tr -d '"' || echo " Unable to parse steps"
else
echo "โš ๏ธ yq not available, showing raw summary info"
grep -A 10 "summary:" test-artifacts/$REPORT_FILE || echo " Unable to extract summary"
fi
else
echo "โš ๏ธ E2E report content is empty or null"
fi
else
echo "โ„น๏ธ No e2e report files found in artifacts"
fi
- name: Decode and save test logs
if: github.event.client_payload.artifacts
run: |
echo "๐Ÿ’พ Extracting test logs..."
# Extract log files (find files with .log extension in artifacts)
echo '${{ toJson(github.event.client_payload.artifacts) }}' | jq -r '
to_entries[] |
select(.key | endswith(".log")) |
"LOG_FILE=\(.key)\nLOG_CONTENT=\(.value.content)"
' > log_vars.env
if [ -f log_vars.env ] && [ -s log_vars.env ]; then
source log_vars.env
# Decode and save log content
if [ ! -z "$LOG_CONTENT" ] && [ "$LOG_CONTENT" != "null" ]; then
echo "$LOG_CONTENT" | base64 -d > "test-artifacts/$LOG_FILE"
echo "โœ… Saved log file: test-artifacts/$LOG_FILE"
# Show log summary
echo ""
echo "๐Ÿ“Š Log file summary:"
echo " Size: $(wc -c < test-artifacts/$LOG_FILE) bytes"
echo " Lines: $(wc -l < test-artifacts/$LOG_FILE) lines"
else
echo "โš ๏ธ Log content is empty or null"
fi
else
echo "โ„น๏ธ No log files found in artifacts"
fi
- name: Create test result summary
run: |
echo "๐Ÿ“ˆ Creating test result summary..."
# Determine status emoji and message
if [ "${{ github.event.client_payload.success }}" == "true" ]; then
STATUS_EMOJI="โœ…"
STATUS_MSG="SUCCESS"
STATUS_COLOR="๐ŸŸข"
else
STATUS_EMOJI="โŒ"
STATUS_MSG="FAILURE"
STATUS_COLOR="๐Ÿ”ด"
fi
echo ""
echo "โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ"
echo "โ”‚ TEST RESULT SUMMARY โ”‚"
echo "โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค"
echo "โ”‚ Status: $STATUS_COLOR $STATUS_EMOJI $STATUS_MSG"
echo "โ”‚ Branch: ${{ github.event.client_payload.branch }}"
echo "โ”‚ Commit: ${{ github.event.client_payload.commit }}"
echo "โ”‚ Source: ${{ github.event.client_payload.source }}"
echo "โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ"
# Show test steps if available
if [ -d test-artifacts ]; then
REPORT_FILE=$(find test-artifacts -name "*-e2e-report.yaml" | head -1)
if [ -f "$REPORT_FILE" ] && command -v yq >/dev/null 2>&1; then
echo ""
echo "๐Ÿ“‹ Test Steps Summary:"
yq '.steps[] | " " + .phase + ": " + .status + " (" + .timestamp + ")"' "$REPORT_FILE" 2>/dev/null | tr -d '"' || echo " No steps data available"
fi
fi
# Create summary for GitHub Actions summary
{
echo "## $STATUS_EMOJI External Test Results - $STATUS_MSG"
echo ""
echo "**Test Details:**"
echo "- **Status**: $STATUS_EMOJI $STATUS_MSG"
echo "- **Branch**: \`${{ github.event.client_payload.branch }}\`"
echo "- **Commit**: \`${{ github.event.client_payload.commit }}\`"
echo "- **Source**: ${{ github.event.client_payload.source }}"
echo "- **Timestamp**: $(date -d @${{ github.event.client_payload.timestamp }} 2>/dev/null || echo "${{ github.event.client_payload.timestamp }}")"
echo ""
echo "**Artifact**: ${{ github.event.client_payload.artifact_name }}"
# Add test steps to GitHub summary if available
if [ -d test-artifacts ]; then
REPORT_FILE=$(find test-artifacts -name "*-e2e-report.yaml" | head -1)
if [ -f "$REPORT_FILE" ] && command -v yq >/dev/null 2>&1; then
echo ""
echo "### ๐Ÿ“‹ Test Steps"
echo ""
yq '.steps[] | "- **" + .phase + "**: " + .status + " _(" + .timestamp + ")_"' "$REPORT_FILE" 2>/dev/null | tr -d '"' || echo "No steps data available"
fi
fi
} >> $GITHUB_STEP_SUMMARY
- name: Upload artifacts
if: github.event.client_payload.artifacts
uses: actions/upload-artifact@v4
with:
name: external-test-results-${{ github.event.client_payload.artifact_name }}
path: test-artifacts/
retention-days: 30