dispatch-with-artifacts #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |