owaiskazi19 commented on code in PR #16894:
URL: https://github.com/apache/lucene/pull/16894#discussion_r4519774293


##########
.github/workflows/run-benchmark-luceneutil.yml:
##########
@@ -0,0 +1,282 @@
+name: "Run benchmark: luceneutil (baseline vs candidate)"
+
+# Runs a luceneutil comparison of two Lucene commits, started by a benchmark 
label on a pull request.
+# See dev-docs/benchmarking-pull-requests.md.
+
+# report-benchmark-luceneutil.yml reads the PR number and label from the run 
name
+run-name: >-
+  ${{ github.event_name == 'pull_request'
+      && format('luceneutil benchmark for PR #{0} ({1})', 
github.event.pull_request.number, github.event.label.name)
+      || 'luceneutil benchmark (manual)' }}
+
+on:
+  # The commit to benchmark is taken from the event, so it is the commit that 
was labeled even if
+  # the PR changes afterwards.
+  pull_request:
+    types: [labeled]
+  workflow_dispatch:
+    inputs:
+      source:
+        description: "luceneutil corpus size"
+        type: choice
+        options:
+          - wikimedium1m
+          - wikimedium10k
+        default: wikimedium1m
+      baseline_ref:
+        description: "Baseline ref (empty = the commit this workflow runs on)"
+        type: string
+        default: ""
+      candidate_ref:
+        description: "Candidate ref (empty = the commit this workflow runs on)"
+        type: string
+        default: ""
+      iterations:
+        description: "Number of JVM iterations per competitor"
+        type: string
+        default: "20"
+      runner:
+        description: "Runner label"
+        type: choice
+        options:
+          - ubuntu-26.04-arm
+          - ubuntu-latest
+        default: ubuntu-26.04-arm
+      attempts:
+        description: "JSON list of attempt ids; each runs as a separate job on 
its own runner"
+        type: string
+        default: "[1]"
+
+permissions: {}
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.run_id }}
+  cancel-in-progress: false
+
+env:
+  CORPUS_FILE: enwiki-20120502-lines-1k-fixed-utf8-with-random-label.txt
+  CORPUS_URL: 
https://pub-6de3254d7180436684278e0ec33ada22.r2.dev/enwiki-20120502-lines-1k-fixed-utf8-with-random-label.txt.lzma
+  # wikimedium1m reads the first 1M docs; +1 for the header line
+  CORPUS_LINES: "1000001"
+  # sha256 of the first CORPUS_LINES lines; checked after every restore and 
download
+  CORPUS_SHA256: 
02b6f0b539d9a82c2e5a215aa5c1690703c74d875fd08b36763253627b1c1896
+  LUCENEUTIL_REF: f77ba1c41c181b9361a7ab5d48fa83b4a367f2e9
+
+defaults:
+  run:
+    shell: bash
+
+jobs:
+  gate:
+    name: Resolve benchmark request
+    if: >-
+      github.event_name == 'workflow_dispatch' ||
+      contains(fromJSON('["benchmark:luceneutil-1m", 
"benchmark:luceneutil-10k"]'), github.event.label.name)
+    timeout-minutes: 5
+    runs-on: ubuntu-26.04-arm
+    permissions:
+      contents: read
+    outputs:
+      pr: ${{ steps.resolve.outputs.pr }}
+      source: ${{ steps.resolve.outputs.source }}
+      baseline: ${{ steps.resolve.outputs.baseline }}
+      candidate: ${{ steps.resolve.outputs.candidate }}
+      iterations: ${{ steps.resolve.outputs.iterations }}
+      runner: ${{ steps.resolve.outputs.runner }}
+      attempts: ${{ steps.resolve.outputs.attempts }}
+
+    steps:
+      - name: Resolve refs and corpus
+        id: resolve
+        env:
+          GH_TOKEN: ${{ github.token }}
+          EVENT_NAME: ${{ github.event_name }}
+          LABEL: ${{ github.event.label.name }}
+          PR_NUMBER: ${{ github.event.pull_request.number }}
+          HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+          BASE_SHA: ${{ github.event.pull_request.base.sha }}
+          DISPATCH_SOURCE: ${{ inputs.source }}
+          DISPATCH_BASELINE: ${{ inputs.baseline_ref }}
+          DISPATCH_CANDIDATE: ${{ inputs.candidate_ref }}
+          DISPATCH_ITERATIONS: ${{ inputs.iterations }}
+          DISPATCH_RUNNER: ${{ inputs.runner }}
+          DISPATCH_ATTEMPTS: ${{ inputs.attempts }}
+        run: |
+          if [ "$EVENT_NAME" = workflow_dispatch ]; then
+            {
+              echo "source=$DISPATCH_SOURCE"
+              echo "baseline=${DISPATCH_BASELINE:-$GITHUB_SHA}"
+              echo "candidate=${DISPATCH_CANDIDATE:-$GITHUB_SHA}"
+              echo "iterations=$DISPATCH_ITERATIONS"
+              echo "runner=$DISPATCH_RUNNER"
+              echo "attempts=$DISPATCH_ATTEMPTS"
+            } >> "$GITHUB_OUTPUT"
+            exit 0
+          fi
+
+          echo "pr=$PR_NUMBER" >> "$GITHUB_OUTPUT"
+          case "$LABEL" in
+            benchmark:luceneutil-1m) source=wikimedium1m ;;
+            benchmark:luceneutil-10k) source=wikimedium10k ;;
+            *) echo "::error::Unexpected label: $LABEL"; exit 1 ;;
+          esac
+          # HEAD_SHA is the commit that was labeled, not the PR head at the 
time this job runs
+          merge_base=$(gh api 
"repos/$GITHUB_REPOSITORY/compare/$BASE_SHA...$HEAD_SHA" --jq 
.merge_base_commit.sha)
+          {
+            echo "source=$source"
+            echo "baseline=$merge_base"
+            echo "candidate=$HEAD_SHA"
+            echo "iterations=20"
+            echo "runner=ubuntu-26.04-arm"
+            echo "attempts=[1]"
+          } >> "$GITHUB_OUTPUT"
+
+  # Builds and runs both commits. PR code runs here, so: read-only token, no 
secrets and
+  # no persisted credentials.
+  benchmark:
+    name: luceneutil ${{ needs.gate.outputs.source }} (attempt ${{ 
matrix.attempt }})
+    needs: gate
+    if: needs.gate.outputs.source != ''
+    timeout-minutes: 120

Review Comment:
   Will go ahead and reduce it to 30 mins. In terms of consistency, yes there 
is some noise in runs but it's nice to catch big regressions



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to