diff options
| author | nkozlovskiy <[email protected]> | 2023-10-11 13:26:26 +0300 |
|---|---|---|
| committer | nkozlovskiy <[email protected]> | 2023-10-11 14:26:39 +0300 |
| commit | 42f0675f6f18e31185186d600373f740f2e4a0b7 (patch) | |
| tree | 58aee98736e5afd80071f696ec8c318e796a82d5 | |
| parent | 1d645bbaca687855582cc1808b4f4508dfc6ba3f (diff) | |
PR from branch users/nkozlovskiy/github-pr-history-link
fix runid
wip
| -rw-r--r-- | .github/actions/test/action.yml | 15 | ||||
| -rwxr-xr-x | .github/scripts/tests/generate-summary.py | 9 |
2 files changed, 17 insertions, 7 deletions
diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index c34210a7919..be6b504531e 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -118,15 +118,19 @@ runs: testmo automation:resources:add-link --name build --url $RUN_URL --resources testmo.json testmo automation:resources:add-field --name git-sha --type string --value ${GITHUB_SHA:0:7} --resources testmo.json - testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{inputs.testman_project_id}} --name "$TESTMO_RUN_NAME" \ - --source "$TESTMO_SOURCE" --resources testmo.json \ - --tags "$BRANCH_TAG" --tags "$EXTRA_TAG" | \ - echo "runid=$(cat)" >> $GITHUB_OUTPUT + + RUN_ID=$( + testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{inputs.testman_project_id}} \ + --name "$TESTMO_RUN_NAME" --source "$TESTMO_SOURCE" --resources testmo.json \ + --tags "$BRANCH_TAG" --tags "$EXTRA_TAG" + ) + echo "runid=${RUN_ID}" >> $GITHUB_OUTPUT + echo "TEST_HISTORY_URL=${TESTMO_URL}/automation/runs/view/${RUN_ID}" >> $GITHUB_ENV - name: Print test history link shell: bash run: | - echo "10 [Test history](${TESTMO_URL}/automation/runs/view/${{steps.th.outputs.runid}})" >> $SUMMARY_LINKS + echo "10 [Test history](${TEST_HISTORY_URL})" >> $SUMMARY_LINKS - name: Run unit tests id: ctest @@ -312,6 +316,7 @@ runs: .github/scripts/tests/generate-summary.py \ --summary-out-path $ARTIFACTS_DIR/summary/ \ --summary-url-prefix $S3_URL_PREFIX/summary/ \ + --test-history-url $TEST_HISTORY_URL \ "Unittests" unittest.html $TESTREPDIR/unittests \ "Unittest binary runs" ctest.html $TESTREPDIR/suites \ "Functional tests" functional.html $PYTESTREPDIR diff --git a/.github/scripts/tests/generate-summary.py b/.github/scripts/tests/generate-summary.py index 6cd3db8aaa0..9f218f55e86 100755 --- a/.github/scripts/tests/generate-summary.py +++ b/.github/scripts/tests/generate-summary.py @@ -268,7 +268,7 @@ def gen_summary(summary_url_prefix, summary_out_folder, paths): return summary -def update_pr_comment(pr: PullRequest, summary: TestSummary): +def update_pr_comment(pr: PullRequest, summary: TestSummary, test_history_url: str): header = f"<!-- status {pr.number} -->" if summary.is_failed: @@ -278,6 +278,10 @@ def update_pr_comment(pr: PullRequest, summary: TestSummary): body = [header, f"{result} for commit {pr.head.sha}."] + if test_history_url: + body.append("") + body.append(f"[Test history]({test_history_url})") + body.extend(summary.render()) body = "\n".join(body) @@ -299,6 +303,7 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument("--summary-out-path", required=True) parser.add_argument("--summary-url-prefix", required=True) + parser.add_argument('--test-history-url', required=False) parser.add_argument("args", nargs="+", metavar="TITLE html_out path") args = parser.parse_args() @@ -319,7 +324,7 @@ def main(): event = json.load(fp) pr = gh.create_from_raw_data(PullRequest, event["pull_request"]) - update_pr_comment(pr, summary) + update_pr_comment(pr, summary, args.test_history_url) if __name__ == "__main__": |
