mirror of
https://github.com/verilator/verilator.git
synced 2026-09-07 10:01:11 +02:00
CI: Show summary tables in 'pr: rtlmeter' results
This commit is contained in:
@@ -182,7 +182,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
path: repo/notification
|
||||
name: coverage-pr-notification
|
||||
name: pr-notification
|
||||
|
||||
# Create GitHub issue for failed scheduled jobs
|
||||
# This should always be the last job (we want an issue if anything breaks)
|
||||
|
||||
@@ -10,7 +10,7 @@ on:
|
||||
paths: ["ci/**", ".github/workflows"]
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["Code coverage"]
|
||||
workflows: ["Code coverage", "RTLMeter"]
|
||||
types: [completed]
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
name: Build content
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
coverage-pr-run-ids: ${{ steps.build.outputs.coverage-pr-run-ids }}
|
||||
pr-run-ids: ${{ steps.build.outputs.pr-run-ids }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
@@ -83,5 +83,5 @@ jobs:
|
||||
- name: Comment on PR
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
COVERAGE_PR_RUN_IDS: ${{ needs.build.outputs.coverage-pr-run-ids }}
|
||||
PR_RUN_IDS: ${{ needs.build.outputs.pr-run-ids }}
|
||||
run: bash -x ./ci/ci-pages-notify.bash
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
---
|
||||
# DESCRIPTION: Github actions config
|
||||
# This name is key to badges in README.rst, so we use the name build
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
name: RTLMeter PR results
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [RTLMeter]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
|
||||
permissions:
|
||||
actions: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Download report
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: rtlmeter-pr-results
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Download PR number
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: pr-number
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Use the Verilator CI app to post the comment
|
||||
- name: Generate access token
|
||||
id: generate-token
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
app-id: ${{ vars.VERILATOR_CI_ID }}
|
||||
private-key: ${{ secrets.VERILATOR_CI_KEY }}
|
||||
permission-pull-requests: write
|
||||
- name: Comment on PR
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
run: |-
|
||||
ls -la
|
||||
cat report.txt
|
||||
gh pr --repo ${{ github.repository }} comment $(cat pr-number.txt) --body-file report.txt
|
||||
@@ -286,106 +286,45 @@ jobs:
|
||||
with:
|
||||
repository: "verilator/rtlmeter"
|
||||
path: rtlmeter
|
||||
|
||||
- name: Setup RTLMeter venv
|
||||
working-directory: rtlmeter
|
||||
run: make venv
|
||||
- name: Download combined results
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Checkout Verilator
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
pattern: all-results-*
|
||||
path: all-results
|
||||
merge-multiple: true
|
||||
- name: Get scheduled run info
|
||||
id: scheduled-info
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
ID=$(gh run --repo ${{ github.repository }} list --workflow RTLMeter --event schedule --status success --limit 1 --json databaseId --jq ".[0].databaseId")
|
||||
echo "id=$ID" >> $GITHUB_OUTPUT
|
||||
URL=$(gh run --repo ${{ github.repository }} view $ID --json url --jq ".url")
|
||||
echo "url=$URL" >> $GITHUB_OUTPUT
|
||||
NUM=$(gh run --repo ${{ github.repository }} view $ID --json number --jq ".number")
|
||||
echo "num=$NUM" >> $GITHUB_OUTPUT
|
||||
DATE=$(gh run --repo ${{ github.repository }} view $ID --json createdAt --jq ".createdAt")
|
||||
echo "date=$DATE" >> $GITHUB_OUTPUT
|
||||
- name: Download scheduled run results
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: published-results
|
||||
path: nightly-results
|
||||
run-id: ${{ steps.scheduled-info.outputs.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Compare results
|
||||
working-directory: rtlmeter
|
||||
run: |
|
||||
for tag in gcc clang gcc-hier; do
|
||||
ADATA=../nightly-results/all-results-${tag}.json
|
||||
BDATA=../all-results/all-results-${tag}.json
|
||||
touch ../verilate-${tag}.txt
|
||||
touch ../execute-${tag}.txt
|
||||
touch ../cppbuild-${tag}.txt
|
||||
if [[ ! -e $ADATA ]]; then
|
||||
continue
|
||||
fi
|
||||
./rtlmeter compare --cases '* !Example:* !*:hello' --steps "verilate" --metrics "elapsed memory" $ADATA $BDATA > ../verilate-${tag}.txt
|
||||
cat ../verilate-${tag}.txt
|
||||
./rtlmeter compare --cases '* !Example:* !*:hello' --steps "execute" --metrics "speed memory elapsed" $ADATA $BDATA > ../execute-${tag}.txt
|
||||
cat ../execute-${tag}.txt
|
||||
./rtlmeter compare --cases '* !Example:* !*:hello' --steps "cppbuild" --metrics "elapsed memory cpu codeSize" $ADATA $BDATA > ../cppbuild-${tag}.txt
|
||||
cat ../cppbuild-${tag}.txt
|
||||
done
|
||||
path: verilator
|
||||
|
||||
- name: Create report
|
||||
working-directory: verilator
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -x
|
||||
NUM=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json number --jq ".number")
|
||||
URL=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json url --jq ".url")
|
||||
echo -n "Performance metrics for PR workflow [#$NUM]($URL) (B) compared to scheduled run" > report.txt
|
||||
echo -n " [#${{ steps.scheduled-info.outputs.num }}](${{ steps.scheduled-info.outputs.url }}) (A)" >> report.txt
|
||||
echo " from ${{ steps.scheduled-info.outputs.date }}" >> report.txt
|
||||
for tag in gcc clang gcc-hier; do
|
||||
echo "" >> report.txt
|
||||
if [[ $tag == "gcc" ]]; then
|
||||
echo "<details open>" >> report.txt
|
||||
else
|
||||
echo "<details>" >> report.txt
|
||||
fi
|
||||
echo -n "<summary><strong><em>" >> report.txt
|
||||
jq -rj ".[0].runName" all-results/all-results-${tag}.json >> report.txt
|
||||
echo "</em></strong></summary>" >> report.txt
|
||||
awk -v RS= -v tag=${tag} '{print > sprintf("frag-%02d-verilate-%s.txt",NR,tag)}' verilate-${tag}.txt
|
||||
awk -v RS= -v tag=${tag} '{print > sprintf("frag-%02d-execute-%s.txt" ,NR,tag)}' execute-${tag}.txt
|
||||
awk -v RS= -v tag=${tag} '{print > sprintf("frag-$02d-cppbuild-%s.txt",NR,tag)}' cppbuild-${tag}.txt
|
||||
for f in $(ls -1 frag-*-verilate-${tag}.txt | sort) $(ls -1 frag-*-execute-${tag}.txt | sort) $(ls -1 frag-*-cppbuild-${tag}.txt | sort); do
|
||||
if [[ $f == frag-01-verilate-${tag}.txt || $f == frag-01-execute-${tag}.txt ]]; then
|
||||
echo "<details open>" >> report.txt
|
||||
else
|
||||
echo "<details>" >> report.txt
|
||||
fi
|
||||
echo -n "<summary>" >> report.txt
|
||||
head -n 1 $f | tr -d '\n' >> report.txt
|
||||
echo "</summary>" >> report.txt
|
||||
echo '<pre>' >> report.txt
|
||||
tail -n +2 $f >> report.txt
|
||||
echo '</pre>' >> report.txt
|
||||
echo "</details>" >> report.txt
|
||||
done
|
||||
echo "</details>" >> report.txt
|
||||
done
|
||||
cat report.txt
|
||||
ln -s ../rtlmeter rtlmeter
|
||||
gh repo set-default ${{ github.repository }}
|
||||
# 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
|
||||
|
||||
- name: Upload report
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
path: report.txt
|
||||
name: rtlmeter-pr-results
|
||||
- name: Save PR number
|
||||
run: echo ${{ github.event.number }} > pr-number.txt
|
||||
- name: Upload PR number
|
||||
name: rtlmeter-pr-report
|
||||
|
||||
- name: Upload notification
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
path: pr-number.txt
|
||||
name: pr-number
|
||||
path: notification
|
||||
name: pr-notification
|
||||
|
||||
# Create GitHub issue for failed scheduled jobs
|
||||
# This should always be the last job (we want an issue if anything breaks)
|
||||
|
||||
Reference in New Issue
Block a user