CI: Generate whole RTLMeter report in ci-rtlmeter-report.bash
This commit is contained in:
parent
067cd6c9c6
commit
4ee19c4065
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 "<h4>RTLMeter reports for '${EVENT}' runs:</h4>" >> ${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 <<REPORT_TEMPLATE
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Verilator RTLMeter report #${WOFKRLOW_NUMBER}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: courier, serif;
|
||||
background-color: #f3f3f3;
|
||||
a {
|
||||
color: #008fd7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
$(cat ${ARTIFACTS_DIR}/report.txt)
|
||||
</body>
|
||||
|
||||
</html>
|
||||
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} <<CONTENTS_TEMPLATE
|
||||
Run <a href="${RUN_ID}.html">#${WOFKRLOW_NUMBER}</a>
|
||||
Run <a href="${RUN_ID}/index.html">#${WOFKRLOW_NUMBER}</a>
|
||||
| GitHub: <a href="${REPO_URL}/actions/runs/${RUN_ID}">${RUN_ID}</a>
|
||||
| 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: <a href=\"${REPO_URL}/pull/${PRNUMBER}\">#${PRNUMBER}</a>" >> ${CONTENTS}
|
||||
fi
|
||||
echo "<br>" >> ${CONTENTS}
|
||||
done
|
||||
|
||||
|
|
|
|||
|
|
@ -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_TEMPLATE
|
||||
Preamble Preamble
|
||||
<details open>
|
||||
<summary><strong>Summary of all runs</strong></summary>
|
||||
<pre>
|
||||
<h3>Summary of all runs</h3>
|
||||
<pre>
|
||||
$(cat $TMP_DIR/summary.txt)
|
||||
</pre>
|
||||
</details>
|
||||
</pre>
|
||||
SUMMARY_TEMPLATE
|
||||
echo "<details>" >> $REPORT
|
||||
echo " <summary><strong>Detailed results</strong></summary>" >> $REPORT
|
||||
echo "<h3>Detailed results</h3>" >> $REPORT
|
||||
for r in $RUNS; do
|
||||
RUN_NAME=$(jq -rj ".[0].runName" $REF_DIR/all-results-$r.json)
|
||||
echo " <details>" >> $REPORT
|
||||
echo " <summary><strong><em>$RUN_NAME</em></strong></summary>" >> $REPORT
|
||||
echo "<h4>$RUN_NAME</h4>" >> $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)
|
|||
</details>
|
||||
DETAIL_TAMPLATE
|
||||
done
|
||||
echo " </details>" >> $REPORT
|
||||
done
|
||||
echo "</details>" >> $REPORT
|
||||
|
||||
# Turn the report into a proper HTML page
|
||||
mkdir -p ${TMP_DIR}/report
|
||||
cat > ${TMP_DIR}/report/index.html <<INDEX_TEMPLATE
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Verilator RTLMeter report #${NEW_NUM}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: courier, serif;
|
||||
background-color: #f3f3f3;
|
||||
a {
|
||||
color: #008fd7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
$(cat ${TMP_DIR}/body.html)
|
||||
</body>
|
||||
|
||||
</html>
|
||||
INDEX_TEMPLATE
|
||||
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Reference in New Issue