CI: Combine RTLMeter collate step to reduce job count (#7729)

This commit is contained in:
Geza Lore 2026-06-07 20:30:57 +01:00 committed by GitHub
parent 83ef69d866
commit 220e46994c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 47 deletions

View File

@ -26,6 +26,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'schedule' }}
env:
RUN_TAGS: gcc clang gcc-hier
jobs:
start:
name: Start
@ -235,18 +238,19 @@ jobs:
name: Combine results
needs: [run-gcc, run-clang, run-gcc-hier]
# Skip if cancelled.
# On PRs, run if something succeded and nothign failed.
# On non-PRs, run if anything succeded or failed (so partial results are still publided).
# On PRs, run if something succeeded and nothing failed.
# On non-PRs, run if anything succeeded or failed (so partial results are still published).
if: >-
${{ !cancelled() && (
(github.event_name == 'pull_request' && (contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure')))
|| (github.event_name != 'pull_request' && (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')))
)}}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
tag: [gcc, clang, gcc-hier]
env:
GH_TOKEN: ${{ github.token }}
# 'gh' resolves the repo from git otherwise, but this job has no checkout
# of this repo at the workspace root
GH_REPO: ${{ github.repository }}
steps:
- name: Checkout RTLMeter
uses: actions/checkout@v6
@ -259,20 +263,24 @@ jobs:
run: make venv
- name: Download all results
uses: actions/download-artifact@v8
with:
pattern: rtlmeter-${{ matrix.tag }}-results-*
path: all-results-${{ matrix.tag }}
merge-multiple: true
run: |
for tag in $RUN_TAGS; do
mkdir artifacts all-results-$tag
gh run download ${{ github.run_id }} --pattern "rtlmeter-$tag-results-*" --dir artifacts
mv $(find artifacts -name "*.json") all-results-$tag/
rm -rf artifacts
done
- name: Combine results
working-directory: rtlmeter
run: |
./rtlmeter collate ../all-results-${{ matrix.tag }}/*.json > ../all-results-${{ matrix.tag }}.json
for tag in $RUN_TAGS; do
./rtlmeter collate ../all-results-$tag/*.json > ../all-results-$tag.json
done
- name: Upload combined results
uses: actions/upload-artifact@v7
with:
path: all-results-${{ matrix.tag }}.json
name: all-results-${{ matrix.tag }}
path: all-results-*.json
name: all-results
overwrite: true
retention-days: 30
@ -280,22 +288,26 @@ jobs:
# 'build-*-old' jobs run and the run jobs produce '*-reference-*' artifacts.
- name: Download reference results
if: ${{ github.event_name == 'pull_request' }}
uses: actions/download-artifact@v8
with:
pattern: rtlmeter-${{ matrix.tag }}-reference-*
path: all-reference-${{ matrix.tag }}
merge-multiple: true
run: |
for tag in $RUN_TAGS; do
mkdir artifacts all-reference-$tag
gh run download ${{ github.run_id }} --pattern "rtlmeter-$tag-reference-*" --dir artifacts
mv $(find artifacts -name "*.json") all-reference-$tag/
rm -rf artifacts
done
- name: Combine reference results
if: ${{ github.event_name == 'pull_request' }}
working-directory: rtlmeter
run: |
./rtlmeter collate ../all-reference-${{ matrix.tag }}/*.json > ../all-reference-${{ matrix.tag }}.json
for tag in $RUN_TAGS; do
./rtlmeter collate ../all-reference-$tag/*.json > ../all-reference-$tag.json
done
- name: Upload reference results
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v7
with:
path: all-reference-${{ matrix.tag }}.json
name: all-reference-${{ matrix.tag }}
path: all-reference-*.json
name: all-reference
overwrite: true
retention-days: 30
@ -313,9 +325,8 @@ jobs:
- name: Download combined results
uses: actions/download-artifact@v8
with:
pattern: all-results-*
name: all-results
path: results
merge-multiple: true
- name: Upload published results
uses: actions/upload-artifact@v7
with:
@ -359,7 +370,7 @@ jobs:
prepare-pr-results:
name: Prepare Pull Request results
needs: combine-results
if: ${{ github.event_name == 'pull_request' && github.repository == 'verilator/verilator' && contains(needs.*.result, 'success') && !cancelled() }}
if: ${{ github.event_name == 'pull_request' && github.repository == 'verilator/verilator' && needs.combine-results.result == 'success' }}
runs-on: ubuntu-24.04
permissions:
actions: read
@ -387,7 +398,7 @@ jobs:
ln -s ../rtlmeter rtlmeter
gh repo set-default ${{ github.repository }}
# Compare to last successful scheduled run
ci/ci-rtlmeter-report.bash ${{ github.run_id }} ${{ github.sha }} gcc clang gcc-hier
ci/ci-rtlmeter-report.bash ${{ github.run_id }} ${{ github.sha }} $RUN_TAGS
# Create the report artifact
mkdir ../report-artifact
mv rtlmeter-report/report ../report-artifact/

View File

@ -4,7 +4,7 @@
# SPDX-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# This scipt builds the content of the response comment posten on PRs
# This script builds the content of the response comment posted on PRs
# at the end of RTLMeter runs.
# Developer note: You should be able to run this script in your local checkout
@ -31,27 +31,15 @@ mkdir rtlmeter-report
pushd rtlmeter-report &> /dev/null
TMP_DIR=$(readlink -f .)
# Artifacts to download
DOWNLOAD_NEW_ARTIFACTS=""
DOWNLOAD_REF_ARTIFACTS=""
for r in $RUNS; do
DOWNLOAD_NEW_ARTIFACTS="$DOWNLOAD_NEW_ARTIFACTS --name all-results-$r"
DOWNLOAD_REF_ARTIFACTS="$DOWNLOAD_REF_ARTIFACTS --name all-reference-$r"
done
# Download reference artifacts
mkdir ref
REF_DIR=$(readlink -f ref)
gh run download ${RUN_ID} $DOWNLOAD_REF_ARTIFACTS --dir $REF_DIR
mv $REF_DIR/*/*.json $REF_DIR/
find $REF_DIR -mindepth 1 -type d -delete
# Download new version artifacts
mkdir new
# Download the combined results. 'combine-results' uploads a single artifact
# for each version, holding the per-tag JSON files (e.g. all-results-gcc.json):
# - 'all-results' for the new version
# - 'all-reference' for the old reference version
mkdir new ref
NEW_DIR=$(readlink -f new)
gh run download ${RUN_ID} $DOWNLOAD_NEW_ARTIFACTS --dir $NEW_DIR
mv $NEW_DIR/*/*.json $NEW_DIR/
find $NEW_DIR -mindepth 1 -type d -delete
REF_DIR=$(readlink -f ref)
gh run download ${RUN_ID} --name all-results --dir $NEW_DIR
gh run download ${RUN_ID} --name all-reference --dir $REF_DIR
# Get Some metadata about the runs
RUN_URL=$(gh run view $RUN_ID --json url --jq ".url")