Skip to content

Commit

Permalink
Improve Merge Logs PR Comment (#448)
Browse files Browse the repository at this point in the history
Signed-off-by: tylertitsworth <[email protected]>
Signed-off-by: Tyler Titsworth <[email protected]>
Co-authored-by: Jitendra Patil <[email protected]>
  • Loading branch information
Tyler Titsworth and jitendra42 authored Oct 11, 2024
1 parent bd9714d commit 95a992e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,21 @@ jobs:
- name: Generate TXT file
if: ${{ steps.check_matching_json_files.outputs.has_matching_json_files == 'true' }}
run: |
echo "| Test-Group | Test | Status |" > output.txt
echo "|---------------|-------------|----------|" >> output.txt
jq -r '.[] | "| \(.Group) | \(.Test) | \(.Status) |" ' combined.json >> output.txt
{
echo "### Integration Test Results"
echo "Groups Tested: $(jq -r 'map(.Group) | unique | join(", ")' combined.json)"
echo -e "\n<details>"
echo -e " <summary>Results</summary>\n"
echo " | Test-Group | Test | Status |"
echo " |:----:|:---:|:---:|"
jq -r '.[] | " | \(.Group) | \(.Test) | \(.Status) |"' combined.json
echo -e "\n</details>\n"
if jq -e 'all(.[]; .Status == "PASS")' combined.json > /dev/null; then
echo "#### Overall Result: PASS ✅"
else
echo "#### Overall Result: FAIL ❌"
fi
} >> output.txt
- name: PR-comment
if: ${{ steps.check_matching_json_files.outputs.has_matching_json_files == 'true' }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
Expand Down
12 changes: 5 additions & 7 deletions test-runner/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_test_list(args: dict, tests_yaml: List[dict]):
rmtree(args.logs_path)
os.makedirs(args.logs_path)
# Set up Logging for test-runner context
unique_identifier = args.logs_path.replace("/", "-")
test_group = os.path.dirname(args.file_path)
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
Expand Down Expand Up @@ -193,22 +193,20 @@ def get_test_list(args: dict, tests_yaml: List[dict]):
logging.error(err)
summary.append([idx + 1, test.name, "FAIL"])
json_summary.append(
{"Group": unique_identifier, "Test": test.name, "Status": "FAIL"}
{"Group": test_group, "Test": test.name, "Status": "FAIL"}
)
ERROR = True
continue
except KeyboardInterrupt:
summary.append([idx + 1, test.name, "FAIL"])
json_summary.append(
{"Group": unique_identifier, "Test": test.name, "Status": "FAIL"}
{"Group": test_group, "Test": test.name, "Status": "FAIL"}
)
ERROR = True
break
summary.append([idx + 1, test.name, "PASS"])
json_summary.append(
{"Group": unique_identifier, "Test": test.name, "Status": "PASS"}
)
json_summary_path = f"test-runner-summary-{unique_identifier}.json"
json_summary.append({"Group": test_group, "Test": test.name, "Status": "PASS"})
json_summary_path = f"test-runner-summary-{test_group}.json"

with open(json_summary_path, "w", encoding="utf-8") as file:
json.dump(json_summary, file, indent=4)
Expand Down

0 comments on commit 95a992e

Please sign in to comment.