From 4ee19c4065db211277c3c8aa09d9d404a656888e Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sun, 7 Jun 2026 09:40:41 +0100 Subject: [PATCH] CI: Generate whole RTLMeter report in ci-rtlmeter-report.bash --- .github/workflows/rtlmeter.yml | 22 ++++---- ci/ci-pages.bash | 55 +++++-------------- ...pr-report.bash => ci-rtlmeter-report.bash} | 52 ++++++++++++------ ...ter-pr-report.py => ci-rtlmeter-report.py} | 0 test_regress/t/t_dist_whitespace.py | 2 +- 5 files changed, 63 insertions(+), 68 deletions(-) rename ci/{ci-rtlmeter-pr-report.bash => ci-rtlmeter-report.bash} (84%) rename ci/{ci-rtlmeter-pr-report.py => ci-rtlmeter-report.py} (100%) diff --git a/.github/workflows/rtlmeter.yml b/.github/workflows/rtlmeter.yml index 626bb994c..3c633d9f0 100644 --- a/.github/workflows/rtlmeter.yml +++ b/.github/workflows/rtlmeter.yml @@ -306,24 +306,26 @@ jobs: # Compare to last successful scheduled run REF_ID=$(gh run list --workflow RTLMeter --event schedule --status success --limit 1 --json databaseId --jq ".[0].databaseId") NEW_ID=${{ github.run_id }} - ci/ci-rtlmeter-pr-report.bash $REF_ID $NEW_ID gcc clang gcc-hier - mv rtlmeter-pr-report/report.txt ../ - cat ../report.txt - # Generate notification comment content - mkdir -p ../notification - mv rtlmeter-pr-report/notification.txt ../notification/body.txt - echo ${{ github.event.number }} > ../notification/pr-number.txt + ci/ci-rtlmeter-report.bash $REF_ID $NEW_ID gcc clang gcc-hier + # Create the report artifact + mkdir ../report-artifact + mv rtlmeter-report/report ../report-artifact/ + echo ${{ github.event.number }} > ../report-artifact/pr-number.txt + # Create the notification artifact + mkdir ../notification-artifact + mv rtlmeter-report/notification.txt ../notification-artifact/body.txt + echo ${{ github.event.number }} > ../notification-artifact/pr-number.txt - name: Upload report uses: actions/upload-artifact@v7 with: - path: report.txt - name: rtlmeter-pr-report + path: report-artifact + name: rtlmeter-report - name: Upload notification uses: actions/upload-artifact@v7 with: - path: notification + path: notification-artifact name: pr-notification # Create GitHub issue for failed scheduled jobs diff --git a/ci/ci-pages.bash b/ci/ci-pages.bash index 44dc3f6d1..bd9fcfaa2 100755 --- a/ci/ci-pages.bash +++ b/ci/ci-pages.bash @@ -44,7 +44,7 @@ compile_coverage_reports() { jq "." completedRuns.json # Create artifacts root directory - local ARTIFACTS_ROOT=artifacts + local ARTIFACTS_ROOT=artifacts-coverage mkdir -p ${ARTIFACTS_ROOT} # Create coverage reports root directory @@ -71,9 +71,7 @@ compile_coverage_reports() { jq "." workflow.json # Record run ID of PR job - if [[ $EVENT == "pull_request" ]]; then - PR_RUN_IDS="$PR_RUN_IDS $RUN_ID" - fi + [[ $EVENT != "pull_request" ]] || PR_RUN_IDS="$PR_RUN_IDS $RUN_ID" # Create workflow artifacts directory local ARTIFACTS_DIR=${ARTIFACTS_ROOT}/${RUN_ID} @@ -170,7 +168,7 @@ compile_rtlmeter_reports() { jq "." completedRuns.json # Create artifacts root directory - local ARTIFACTS_ROOT=artifacts + local ARTIFACTS_ROOT=artifacts-rtlmeter mkdir -p ${ARTIFACTS_ROOT} # Create rtlmeter reports root directory @@ -197,20 +195,18 @@ compile_rtlmeter_reports() { jq "." workflow.json # Record run ID of PR job - if [[ $EVENT == "pull_request" ]]; then - PR_RUN_IDS="$PR_RUN_IDS $RUN_ID" - fi + [[ $EVENT != "pull_request" ]] || PR_RUN_IDS="$PR_RUN_IDS $RUN_ID" # Create workflow artifacts directory local ARTIFACTS_DIR=${ARTIFACTS_ROOT}/${RUN_ID} mkdir -p ${ARTIFACTS_DIR} # Download artifacts of this run, if exists - gh run download ${RUN_ID} --name rtlmeter-pr-report --dir ${ARTIFACTS_DIR} || true + gh run download ${RUN_ID} --name rtlmeter-report --dir ${ARTIFACTS_DIR} || true ls -lsha ${ARTIFACTS_DIR} # Move on if no RTLMeter report is available - if [ ! -f ${ARTIFACTS_DIR}/report.txt ]; then + if [ ! -d ${ARTIFACTS_DIR}/report ]; then echo "No RTLMeter report found" continue fi @@ -222,42 +218,21 @@ compile_rtlmeter_reports() { echo "

RTLMeter reports for '${EVENT}' runs:

" >> ${CONTENTS} fi - # Extract run metadata - local WORKFLOW_CREATED=$(jq -r '.createdAt' workflow.json) - local WOFKRLOW_NUMBER=$(jq -r '.number' workflow.json) - - # Wrap the report into an HTML page. The report content is already HTML - # (produced by ci-rtlmeter-pr-report.bash), so we just embed it in the - # page body. - cat > ${RTLMETER_ROOT}/${RUN_ID}.html < - - - Verilator RTLMeter report #${WOFKRLOW_NUMBER} - - - - -$(cat ${ARTIFACTS_DIR}/report.txt) - - - -REPORT_TEMPLATE + # Create pages subdirectory + mv ${ARTIFACTS_DIR}/report ${RTLMETER_ROOT}/${RUN_ID} # Add index page content + local WORKFLOW_CREATED=$(jq -r '.createdAt' workflow.json) + local WOFKRLOW_NUMBER=$(jq -r '.number' workflow.json) cat >> ${CONTENTS} <#${WOFKRLOW_NUMBER} + Run #${WOFKRLOW_NUMBER} | GitHub: ${RUN_ID} | started at: ${WORKFLOW_CREATED} CONTENTS_TEMPLATE + if [ -e ${ARTIFACTS_DIR}/pr-number.txt ]; then + local PRNUMBER=$(cat ${ARTIFACTS_DIR}/pr-number.txt) + echo " | Pull request: #${PRNUMBER}" >> ${CONTENTS} + fi echo "
" >> ${CONTENTS} done diff --git a/ci/ci-rtlmeter-pr-report.bash b/ci/ci-rtlmeter-report.bash similarity index 84% rename from ci/ci-rtlmeter-pr-report.bash rename to ci/ci-rtlmeter-report.bash index f44f074e2..fd231c732 100755 --- a/ci/ci-rtlmeter-pr-report.bash +++ b/ci/ci-rtlmeter-report.bash @@ -26,9 +26,9 @@ RUNS="$@" SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]})) # Move into a temporary directory -rm -rf rtlmeter-pr-report -mkdir rtlmeter-pr-report -pushd rtlmeter-pr-report &> /dev/null +rm -rf rtlmeter-report +mkdir rtlmeter-report +pushd rtlmeter-report &> /dev/null TMP_DIR=$(readlink -f .) # Artifacts to download @@ -83,7 +83,7 @@ for r in $RUNS; do done # Create summary -venv/bin/python3 $SCRIPT_DIR/ci-rtlmeter-pr-report.py ${SUMMARY_ARGS[@]} > $TMP_DIR/summary.txt +venv/bin/python3 $SCRIPT_DIR/ci-rtlmeter-report.py ${SUMMARY_ARGS[@]} > $TMP_DIR/summary.txt # Print it cat $TMP_DIR/summary.txt @@ -102,22 +102,17 @@ Blah Blah Blah NOTIFICATION_TEMPLATE # Create detailed report -REPORT=$TMP_DIR/report.txt +REPORT=$TMP_DIR/body.html cat > $REPORT < - Summary of all runs -
+

Summary of all runs

+
 $(cat $TMP_DIR/summary.txt)
-  
- +
SUMMARY_TEMPLATE -echo "
" >> $REPORT -echo " Detailed results" >> $REPORT +echo "

Detailed results

" >> $REPORT for r in $RUNS; do RUN_NAME=$(jq -rj ".[0].runName" $REF_DIR/all-results-$r.json) - echo "
" >> $REPORT - echo " $RUN_NAME" >> $REPORT + echo "

$RUN_NAME

" >> $REPORT for f in $(ls -1 $TMP_DIR/$r-frag-verilate-*.txt | sort) \ $(ls -1 $TMP_DIR/$r-frag-cppbuild-*.txt | sort) \ $(ls -1 $TMP_DIR/$r-frag-execute-*.txt | sort); do @@ -130,6 +125,29 @@ $(tail -n +2 $f)
DETAIL_TAMPLATE done - echo "
" >> $REPORT done -echo "" >> $REPORT + +# Turn the report into a proper HTML page +mkdir -p ${TMP_DIR}/report +cat > ${TMP_DIR}/report/index.html < + + + Verilator RTLMeter report #${NEW_NUM} + + + + +$(cat ${TMP_DIR}/body.html) + + + +INDEX_TEMPLATE diff --git a/ci/ci-rtlmeter-pr-report.py b/ci/ci-rtlmeter-report.py similarity index 100% rename from ci/ci-rtlmeter-pr-report.py rename to ci/ci-rtlmeter-report.py diff --git a/test_regress/t/t_dist_whitespace.py b/test_regress/t/t_dist_whitespace.py index 87f1fe8ef..a14988064 100755 --- a/test_regress/t/t_dist_whitespace.py +++ b/test_regress/t/t_dist_whitespace.py @@ -13,7 +13,7 @@ test.scenarios('dist') Tabs_Exempt_Re = r'(\.out$)|(/fstcpp)|(Makefile)|(\.mk$)|(\.mk\.in$)|test_regress/t/t_preproc\.v|install-sh' -Unicode_Exempt_Re = r'(Changes$|CONTRIBUTORS$|LICENSES?|contributors.rst$|spelling.txt$|ci-rtlmeter-pr-report.py)' +Unicode_Exempt_Re = r'(Changes$|CONTRIBUTORS$|LICENSES?|contributors.rst$|spelling.txt$|ci-rtlmeter-report.py)' def get_source_files():