From ec27d28be44d496a78ddcbc6d55538ccf3c4e165 Mon Sep 17 00:00:00 2001 From: Tyler Titsworth Date: Thu, 17 Oct 2024 09:00:58 -0700 Subject: [PATCH] Patch Merge Logs Pathing (#459) Signed-off-by: tylertitsworth --- .github/workflows/integration-test.yaml | 23 +++++++++++------------ .gitignore | 1 - test-runner/action.yml | 2 +- test-runner/test_runner.py | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index b3606675..3d1ba36b 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -84,24 +84,23 @@ jobs: with: pattern: test-runner-summary* merge-multiple: true - - name: Check for JSON files + - name: Find Summary + id: summary shell: bash run: | - if [[ -n "$(find . -maxdepth 1 -name 'test-runner-summary*.json' -print -quit)" ]]; then - echo "has_matching_json_files=true" >> "$GITHUB_OUTPUT" + SUMMARY=$(find . -maxdepth 3 -name '*summary.json' -print) + if [[ -n "$SUMMARY" ]]; then + echo "summary=$SUMMARY" >> "$GITHUB_OUTPUT" echo "Files matching the pattern test-runner-summary*.json found in the directory" + summary_dir=$(dirname "$SUMMARY") + jq -s '[.[] | .[]]' $summary_dir/*summary.json > combined.json + echo "Files found in the directory" else - echo "has_matching_json_files=false" >> "$GITHUB_OUTPUT" + echo "summary=false" >> "$GITHUB_OUTPUT" echo "No files matching the pattern test-runner-summary*.json found in the directory" fi - id: check_matching_json_files - - name: Combine JSON files - if: ${{ steps.check_matching_json_files.outputs.has_matching_json_files == 'true' }} - run: | - jq -s '[.[] | .[]]' *.json > combined.json - echo "Files found in the directory" - name: Generate TXT file - if: ${{ steps.check_matching_json_files.outputs.has_matching_json_files == 'true' }} + if: ${{ steps.summary.outputs.summary != 'false' }} run: | { echo "### Integration Test Results" @@ -119,7 +118,7 @@ jobs: fi } >> output.txt - name: PR-comment - if: ${{ steps.check_matching_json_files.outputs.has_matching_json_files == 'true' }} + if: ${{ steps.summary.outputs.summary == 'true' }} uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index d6f27a92..f3e1d08f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,4 @@ logs/ models-perf/ output/ site -test-runner-summary-output.json venv/ diff --git a/test-runner/action.yml b/test-runner/action.yml index 16bc9b32..6dd02980 100644 --- a/test-runner/action.yml +++ b/test-runner/action.yml @@ -81,5 +81,5 @@ runs: if: always() with: name: test-runner-summary ${{ env.test }} - path: test-runner-summary*.json + path: ${{ inputs.test_dir }}/logs/*summary.json overwrite: true diff --git a/test-runner/test_runner.py b/test-runner/test_runner.py index b455e5e5..f8456d92 100644 --- a/test-runner/test_runner.py +++ b/test-runner/test_runner.py @@ -206,7 +206,7 @@ def get_test_list(args: dict, tests_yaml: List[dict]): break summary.append([idx + 1, test.name, "PASS"]) json_summary.append({"Group": test_group, "Test": test.name, "Status": "PASS"}) - json_summary_path = f"test-runner-summary-{test_group}.json" + json_summary_path = f"{args.logs_path}/{test_group.replace('/', '-')}-summary.json" with open(json_summary_path, "w", encoding="utf-8") as file: json.dump(json_summary, file, indent=4)