Skip to content

Commit 8c186e0

Browse files
committed
Improve GitHub benchmark workflow with configurable build options
- Add configure_flags and make_flags workflow inputs with sensible defaults - Increase git fetch depth from 50 to 200 commits for better history access - Fix command construction and argument quoting - Add conditional flag handling to support flexible build configurations - Remove --local-checkout flag and simplify command structure
1 parent 7e7613d commit 8c186e0

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

.github/workflows/benchmark.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ on:
2323
description: 'CPython repository URL'
2424
required: false
2525
default: 'https://github.com/python/cpython.git'
26+
configure_flags:
27+
description: 'Configure flags for CPython build'
28+
required: false
29+
default: '-C'
30+
make_flags:
31+
description: 'Make flags for CPython build'
32+
required: false
33+
default: '-j'
2634

2735
jobs:
2836
benchmark:
@@ -41,7 +49,7 @@ jobs:
4149
run: |
4250
git clone ${{ github.event.inputs.cpython_repo }} cpython
4351
cd cpython
44-
git fetch --depth=50
52+
git fetch --depth=200
4553
4654
- name: Install memory tracker worker
4755
run: |
@@ -65,18 +73,26 @@ jobs:
6573
env:
6674
MEMORY_TRACKER_TOKEN: ${{ secrets.MEMORY_TRACKER_TOKEN }}
6775
run: |
68-
# Build command with preconfigured options
69-
CMD="memory-tracker benchmark ./cpython ${{ github.event.inputs.commit_range }}"
70-
CMD="$CMD --binary-id ${{ github.event.inputs.binary_id }}"
71-
CMD="$CMD --environment-id ${{ github.event.inputs.environment_id }}"
72-
CMD="$CMD --api-base ${{ github.event.inputs.server_url }}"
73-
CMD="$CMD --configure-flags='-C'"
74-
CMD="$CMD --make-flags='-j4'"
75-
CMD="$CMD --output-dir='./benchmark_results'"
76+
# Build command with conditional flags
77+
CMD="memory-tracker benchmark '${{ github.event.inputs.commit_range }}'"
78+
CMD="$CMD --repo-path ./cpython"
79+
CMD="$CMD --binary-id '${{ github.event.inputs.binary_id }}'"
80+
CMD="$CMD --environment-id '${{ github.event.inputs.environment_id }}'"
81+
CMD="$CMD --api-base '${{ github.event.inputs.server_url }}'"
82+
CMD="$CMD --output-dir ./benchmark_results"
7683
CMD="$CMD --force"
77-
CMD="$CMD --local-checkout"
7884
CMD="$CMD -vv"
7985
86+
# Add configure flags if provided
87+
if [ -n "${{ github.event.inputs.configure_flags }}" ]; then
88+
CMD="$CMD --configure-flags='${{ github.event.inputs.configure_flags }}'"
89+
fi
90+
91+
# Add make flags if provided
92+
if [ -n "${{ github.event.inputs.make_flags }}" ]; then
93+
CMD="$CMD --make-flags='${{ github.event.inputs.make_flags }}'"
94+
fi
95+
8096
echo "Running: $CMD"
8197
eval $CMD
8298

0 commit comments

Comments
 (0)