Merge pull request #35999 from ClickHouse/build-report

Build report
This commit is contained in:
Mikhail f. Shiryaev 2022-04-06 19:06:15 +02:00 committed by GitHub
commit f7dda074a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 19 deletions

View File

@ -341,10 +341,15 @@ jobs:
steps: steps:
- name: Set envs - name: Set envs
run: | run: |
DEPENDENCIES=$(cat << 'EOF' | jq '. | length'
${{ toJSON(needs) }}
EOF
)
echo "DEPENDENCIES=$DEPENDENCIES" >> "$GITHUB_ENV"
cat >> "$GITHUB_ENV" << 'EOF' cat >> "$GITHUB_ENV" << 'EOF'
TEMP_PATH=${{runner.temp}}/report_check
REPORTS_PATH=${{runner.temp}}/reports_dir
CHECK_NAME=ClickHouse build check (actions) CHECK_NAME=ClickHouse build check (actions)
REPORTS_PATH=${{runner.temp}}/reports_dir
TEMP_PATH=${{runner.temp}}/report_check
EOF EOF
- name: Download json reports - name: Download json reports
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -360,7 +365,7 @@ jobs:
sudo rm -fr "$TEMP_PATH" sudo rm -fr "$TEMP_PATH"
mkdir -p "$TEMP_PATH" mkdir -p "$TEMP_PATH"
cd "$GITHUB_WORKSPACE/tests/ci" cd "$GITHUB_WORKSPACE/tests/ci"
python3 build_report_check.py "$CHECK_NAME" python3 build_report_check.py "$CHECK_NAME" "$DEPENDENCIES"
- name: Cleanup - name: Cleanup
if: always() if: always()
run: | run: |

View File

@ -992,10 +992,16 @@ jobs:
steps: steps:
- name: Set envs - name: Set envs
run: | run: |
DEPENDENCIES=$(cat << 'EOF' | jq '. | length'
${{ toJSON(needs) }}
EOF
)
echo "DEPENDENCIES=$DEPENDENCIES" >> "$GITHUB_ENV"
cat >> "$GITHUB_ENV" << 'EOF' cat >> "$GITHUB_ENV" << 'EOF'
TEMP_PATH=${{runner.temp}}/report_check
REPORTS_PATH=${{runner.temp}}/reports_dir
CHECK_NAME=ClickHouse build check (actions) CHECK_NAME=ClickHouse build check (actions)
REPORTS_PATH=${{runner.temp}}/reports_dir
REPORTS_PATH=${{runner.temp}}/reports_dir
TEMP_PATH=${{runner.temp}}/report_check
EOF EOF
- name: Download json reports - name: Download json reports
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -1011,7 +1017,7 @@ jobs:
sudo rm -fr "$TEMP_PATH" sudo rm -fr "$TEMP_PATH"
mkdir -p "$TEMP_PATH" mkdir -p "$TEMP_PATH"
cd "$GITHUB_WORKSPACE/tests/ci" cd "$GITHUB_WORKSPACE/tests/ci"
python3 build_report_check.py "$CHECK_NAME" python3 build_report_check.py "$CHECK_NAME" "$DEPENDENCIES"
- name: Cleanup - name: Cleanup
if: always() if: always()
run: | run: |

View File

@ -1044,10 +1044,16 @@ jobs:
steps: steps:
- name: Set envs - name: Set envs
run: | run: |
DEPENDENCIES=$(cat << 'EOF' | jq '. | length'
${{ toJSON(needs) }}
EOF
)
echo "DEPENDENCIES=$DEPENDENCIES" >> "$GITHUB_ENV"
cat >> "$GITHUB_ENV" << 'EOF' cat >> "$GITHUB_ENV" << 'EOF'
TEMP_PATH=${{runner.temp}}/report_check
REPORTS_PATH=${{runner.temp}}/reports_dir
CHECK_NAME=ClickHouse build check (actions) CHECK_NAME=ClickHouse build check (actions)
REPORTS_PATH=${{runner.temp}}/reports_dir
REPORTS_PATH=${{runner.temp}}/reports_dir
TEMP_PATH=${{runner.temp}}/report_check
EOF EOF
- name: Download json reports - name: Download json reports
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -1063,7 +1069,7 @@ jobs:
sudo rm -fr "$TEMP_PATH" sudo rm -fr "$TEMP_PATH"
mkdir -p "$TEMP_PATH" mkdir -p "$TEMP_PATH"
cd "$GITHUB_WORKSPACE/tests/ci" cd "$GITHUB_WORKSPACE/tests/ci"
python3 build_report_check.py "$CHECK_NAME" python3 build_report_check.py "$CHECK_NAME" "$DEPENDENCIES"
- name: Cleanup - name: Cleanup
if: always() if: always()
run: | run: |

View File

@ -436,10 +436,16 @@ jobs:
steps: steps:
- name: Set envs - name: Set envs
run: | run: |
DEPENDENCIES=$(cat << 'EOF' | jq '. | length'
${{ toJSON(needs) }}
EOF
)
echo "DEPENDENCIES=$DEPENDENCIES" >> "$GITHUB_ENV"
cat >> "$GITHUB_ENV" << 'EOF' cat >> "$GITHUB_ENV" << 'EOF'
TEMP_PATH=${{runner.temp}}/report_check
REPORTS_PATH=${{runner.temp}}/reports_dir
CHECK_NAME=ClickHouse build check (actions) CHECK_NAME=ClickHouse build check (actions)
REPORTS_PATH=${{runner.temp}}/reports_dir
REPORTS_PATH=${{runner.temp}}/reports_dir
TEMP_PATH=${{runner.temp}}/report_check
EOF EOF
- name: Download json reports - name: Download json reports
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -455,7 +461,7 @@ jobs:
sudo rm -fr "$TEMP_PATH" sudo rm -fr "$TEMP_PATH"
mkdir -p "$TEMP_PATH" mkdir -p "$TEMP_PATH"
cd "$GITHUB_WORKSPACE/tests/ci" cd "$GITHUB_WORKSPACE/tests/ci"
python3 build_report_check.py "$CHECK_NAME" python3 build_report_check.py "$CHECK_NAME" "$DEPENDENCIES"
- name: Cleanup - name: Cleanup
if: always() if: always()
run: | run: |

View File

@ -120,6 +120,7 @@ if __name__ == "__main__":
os.makedirs(temp_path) os.makedirs(temp_path)
build_check_name = sys.argv[1] build_check_name = sys.argv[1]
reports_length = int(sys.argv[2]) if len(sys.argv) > 2 else 0
gh = Github(get_best_robot_token()) gh = Github(get_best_robot_token())
pr_info = PRInfo() pr_info = PRInfo()
@ -138,7 +139,7 @@ if __name__ == "__main__":
logging.info("Found build report json %s", f) logging.info("Found build report json %s", f)
build_name = get_build_name_from_file_name(f) build_name = get_build_name_from_file_name(f)
if build_name in reports_order: if build_name in reports_order:
with open(os.path.join(root, f), "r") as file_handler: with open(os.path.join(root, f), "rb") as file_handler:
build_report = json.load(file_handler) build_report = json.load(file_handler)
build_reports_map[build_name] = build_report build_reports_map[build_name] = build_report
else: else:
@ -148,7 +149,8 @@ if __name__ == "__main__":
build_name, build_name,
) )
some_builds_are_missing = len(build_reports_map) < len(reports_order) reports_length = reports_length or len(reports_order)
some_builds_are_missing = len(build_reports_map) < reports_length
if some_builds_are_missing: if some_builds_are_missing:
logging.info( logging.info(
@ -188,7 +190,7 @@ if __name__ == "__main__":
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commits/master" branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commits/master"
branch_name = "master" branch_name = "master"
if pr_info.number != 0: if pr_info.number != 0:
branch_name = "PR #{}".format(pr_info.number) branch_name = f"PR #{pr_info.number}"
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_info.number}" branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_info.number}"
commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{pr_info.sha}" commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{pr_info.sha}"
task_url = GITHUB_RUN_URL task_url = GITHUB_RUN_URL
@ -204,8 +206,8 @@ if __name__ == "__main__":
) )
report_path = os.path.join(temp_path, "report.html") report_path = os.path.join(temp_path, "report.html")
with open(report_path, "w") as f: with open(report_path, "w", encoding="utf-8") as fd:
f.write(report) fd.write(report)
logging.info("Going to upload prepared report") logging.info("Going to upload prepared report")
context_name_for_path = build_check_name.lower().replace(" ", "_") context_name_for_path = build_check_name.lower().replace(" ", "_")
@ -235,11 +237,11 @@ if __name__ == "__main__":
addition = "" addition = ""
if some_builds_are_missing: if some_builds_are_missing:
addition = "(some builds are missing)" addition = f"({len(build_reports_map)} < {reports_length})"
description = f"{ok_builds}/{total_builds} builds are OK {addition}" description = f"{ok_builds}/{total_builds} builds are OK {addition}"
print("::notice ::Report url: {}".format(url)) print(f"::notice ::Report url: {url}")
commit = get_commit(gh, pr_info.sha) commit = get_commit(gh, pr_info.sha)
commit.create_status( commit.create_status(