diff --git a/.github/scripts/de1-soc-synthesis-metrics-diff/aggregate_metrics.sh b/.github/scripts/de1-soc-synthesis-metrics-diff/aggregate_metrics.sh index e395ada..599e4ca 100644 --- a/.github/scripts/de1-soc-synthesis-metrics-diff/aggregate_metrics.sh +++ b/.github/scripts/de1-soc-synthesis-metrics-diff/aggregate_metrics.sh @@ -6,6 +6,7 @@ set -euo pipefail ARTIFACTS_DIR="${1:-metrics-diff}" OUTPUT_FILE="${2:-comparison.md}" +BASE_BRANCH="${BASE_BRANCH:-base branch}" append_metric_cell() { local file="$1" @@ -43,4 +44,4 @@ fi echo "" >> "$OUTPUT_FILE" echo "---" >> "$OUTPUT_FILE" -echo "*Comparing synthesis results from main branch vs. this PR*" >> "$OUTPUT_FILE" +echo "*Comparing synthesis results from \`$BASE_BRANCH\` branch vs. this PR*" >> "$OUTPUT_FILE" diff --git a/.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh b/.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh index 9cbd9c1..9491884 100755 --- a/.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh +++ b/.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh @@ -1,17 +1,18 @@ #!/bin/bash -# Script to compare a synthesis report between main and PR branches -# Usage: compare_metrics_diff.sh -# Example: compare_metrics_diff.sh "main-reports/report.summary" "pr-reports/report.summary" +# Script to compare a synthesis report between base and PR branches +# Usage: compare_metrics_diff.sh +# Example: compare_metrics_diff.sh "base-reports/report.summary" "pr-reports/report.summary" set -e if [ $# -lt 2 ]; then - echo "Usage: $0 " >&2 + echo "Usage: $0 " >&2 exit 1 fi -MAIN_REPORT="$1" +BASE_REPORT="$1" PR_REPORT="$2" +BASE_BRANCH="${BASE_BRANCH:-base branch}" if [ ! -f "$PR_REPORT" ]; then echo "ERROR: PR report not found at $PR_REPORT" >&2 @@ -19,9 +20,9 @@ if [ ! -f "$PR_REPORT" ]; then fi { - if [ -f "$MAIN_REPORT" ]; then + if [ -f "$BASE_REPORT" ]; then # Generate diff and capture output - DIFF_OUTPUT=$(diff -u "$MAIN_REPORT" "$PR_REPORT" | tail -n +3 || true) + DIFF_OUTPUT=$(diff -u "$BASE_REPORT" "$PR_REPORT" | tail -n +3 || true) if [ -z "$DIFF_OUTPUT" ]; then echo "*No changes detected*" else @@ -30,7 +31,7 @@ fi echo "\`\`\`" fi else - echo "*No baseline available from main branch*" + echo "*No baseline available from \`$BASE_BRANCH\` branch*" echo "" echo "
" echo "View PR synthesis results" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6a7fcc2..9fe0365 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -233,6 +233,8 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write + env: + BASE_BRANCH: ${{ github.base_ref }} strategy: matrix: *utoss-risc-v-matrix @@ -300,6 +302,8 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write + env: + BASE_BRANCH: ${{ github.base_ref }} steps: - name: Checkout code