From c489a306075775205cbaeb0d2eb9569b30db5172 Mon Sep 17 00:00:00 2001 From: aehnh Date: Tue, 4 Feb 2025 19:14:23 +0100 Subject: [PATCH] send react complete logs to cloudwatch --- .github/workflows/e2e-test-commitly.yml | 21 +++++++++++++++++++ .../tests-e2e/playwright.config.complete.ts | 1 + .../tests-e2e/playwright.config.connect.ts | 1 + 3 files changed, 23 insertions(+) diff --git a/.github/workflows/e2e-test-commitly.yml b/.github/workflows/e2e-test-commitly.yml index 132865eab..8396bed2f 100644 --- a/.github/workflows/e2e-test-commitly.yml +++ b/.github/workflows/e2e-test-commitly.yml @@ -89,6 +89,27 @@ jobs: path: packages/tests-e2e/playwright-report/ retention-days: 30 + - name: Send logs to AWS CloudWatch + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + run: | + cat test-results/results.xml + TESTS=$(xmllint --xpath 'string(/testsuites/@tests)' test-results/results.xml) + FAILURES=$(xmllint --xpath 'string(/testsuites/@failures)' test-results/results.xml) + SKIPPED=$(xmllint --xpath 'string(/testsuites/@skipped)' test-results/results.xml) + ERRORS=$(xmllint --xpath 'string(/testsuites/@errors)' test-results/results.xml) + TIME=$(xmllint --xpath 'string(/testsuites/@time)' test-results/results.xml) + PASSED=$((TESTS - FAILURES - ERRORS - SKIPPED)) + FAILED=$((FAILURES + ERRORS)) + SUMMARY="[Test Result] application=complete platform=react run_type=commitly execution_time=$TIME passed=$PASSED failed=$FAILED" + TIMESTAMP=$(date +%s000) + LOG_STREAM_NAME="complete-$TIMESTAMP" + aws logs create-log-stream --log-group-name "test-results-board" --log-stream-name "&LOG_STREAM_NAME" + LOG_EVENT_JSON="[{\"timestamp\":$TIMESTAMP,\"message\":\"$SUMMARY\"}]" + aws logs put-log-events --log-group-name "test-results-board" --log-stream-name "$LOG_STREAM_NAME" --log-events "$LOG_EVENT_JSON" + - name: Run Connect tests for react run: | cd packages/tests-e2e diff --git a/packages/tests-e2e/playwright.config.complete.ts b/packages/tests-e2e/playwright.config.complete.ts index 79f2e8140..98c9a61dd 100644 --- a/packages/tests-e2e/playwright.config.complete.ts +++ b/packages/tests-e2e/playwright.config.complete.ts @@ -44,6 +44,7 @@ export default defineConfig({ }, ], ['html'], + ['junit', { outputFile: 'test-results/results.xml' }], ], timeout: totalTimeout, // default: 30000ms expect: { diff --git a/packages/tests-e2e/playwright.config.connect.ts b/packages/tests-e2e/playwright.config.connect.ts index 3e01e1a93..3b634f59f 100644 --- a/packages/tests-e2e/playwright.config.connect.ts +++ b/packages/tests-e2e/playwright.config.connect.ts @@ -37,6 +37,7 @@ export default defineConfig({ }, ], ['html'], + ['junit', { outputFile: 'test-results/results.xml' }], ], timeout: totalTimeout, // default: 30000ms expect: {