Skip to content

test-dispatch-with-artifacts #9

test-dispatch-with-artifacts

test-dispatch-with-artifacts #9

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: 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: 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"
# Show key information from logs
echo ""
echo "๐Ÿ” Test execution highlights:"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
# Extract key information
if grep -q "Install kind" "test-artifacts/$LOG_FILE"; then
echo " โœ… Kind installation step found"
fi
if grep -q "Create k8s cluster" "test-artifacts/$LOG_FILE"; then
echo " โœ… Kubernetes cluster creation step found"
fi
if grep -q "kubectl get" "test-artifacts/$LOG_FILE"; then
echo " โœ… Kubernetes verification commands found"
fi
# Show any errors
if grep -qi "error\|fail" "test-artifacts/$LOG_FILE"; then
echo " โš ๏ธ Errors or failures detected:"
grep -i "error\|fail" "test-artifacts/$LOG_FILE" | head -3 | sed 's/^/ /'
fi
# Show success indicators
if grep -q "Ready.*control-plane" "test-artifacts/$LOG_FILE"; then
echo " โœ… Kubernetes control plane ready"
fi
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 "โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ"
# Create summary for GitHub Actions summary
cat >> $GITHUB_STEP_SUMMARY << EOF
## $STATUS_EMOJI External Test Results - $STATUS_MSG
**Test Details:**
- **Status**: $STATUS_EMOJI $STATUS_MSG
- **Branch**: \`${{ github.event.client_payload.branch }}\`
- **Commit**: \`${{ github.event.client_payload.commit }}\`
- **Source**: ${{ github.event.client_payload.source }}
- **Timestamp**: $(date -d @${{ github.event.client_payload.timestamp }} 2>/dev/null || echo "${{ github.event.client_payload.timestamp }}")
**Artifact**: ${{ github.event.client_payload.artifact_name }}
EOF
- 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