@@ -2,22 +2,18 @@ name: Daily Memory Tracker Benchmark
22
33on :
44 schedule :
5- # Run daily at 02 :00 UTC
6- - cron : ' 0 2 * * *'
5+ # Run daily at 23 :00 UTC (EOD) to pick up all commits from the day
6+ - cron : ' 0 23 * * *'
77 workflow_dispatch :
88 inputs :
99 target_date :
1010 description : ' Date to get commits from (YYYY-MM-DD, defaults to today)'
1111 required : false
1212 type : string
13- binary_id :
14- description : ' Binary ID to use for benchmarking'
15- required : false
16- default : ' default'
1713 environment_id :
1814 description : ' Environment ID'
1915 required : false
20- default : ' gcc-11 '
16+ default : ' gh_actions '
2117 server_url :
2218 description : ' Memory tracker server URL'
2319 required : false
2622 description : ' CPython repository URL'
2723 required : false
2824 default : ' https://github.com/python/cpython.git'
25+ llvm :
26+ description : ' LLVM version to use for JIT builds'
27+ required : false
28+ default : ' 18'
2929
3030jobs :
3131 get-daily-commits :
@@ -75,15 +75,30 @@ jobs:
7575 echo "$COMMITS"
7676 fi
7777
78- benchmark-commits :
78+ benchmark-builds :
7979 needs : get-daily-commits
8080 if : needs.get-daily-commits.outputs.commit-count > 0
8181 runs-on : ubuntu-latest
8282 strategy :
8383 matrix :
84- commit : ${{ fromJson(needs.get-daily-commits.outputs.commits) }}
84+ build_config :
85+ - binary_id : ' default'
86+ configure_flags : ' -C'
87+ description : ' Default build'
88+ install_deps : ' standard'
89+ - binary_id : ' debug'
90+ configure_flags : ' --with-pydebug'
91+ description : ' Debug build'
92+ install_deps : ' standard'
93+ - binary_id : ' jit'
94+ configure_flags : ' --enable-experimental-jit'
95+ description : ' JIT build'
96+ install_deps : ' jit'
97+ - binary_id : ' nogil'
98+ configure_flags : ' --disable-gil'
99+ description : ' Free-threaded build'
100+ install_deps : ' standard'
85101 fail-fast : false
86- max-parallel : 3
87102
88103 steps :
89104 - name : Checkout memory tracker
@@ -110,6 +125,11 @@ jobs:
110125 # Install CPython dependencies using their script
111126 cd cpython
112127 sudo .github/workflows/posix-deps-apt.sh
128+
129+ # Install JIT dependencies if needed
130+ if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
131+ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ github.event.inputs.llvm || '18' }}
132+ fi
113133
114134 # Install Memray dependencies
115135 sudo apt-get install -y \
@@ -118,31 +138,39 @@ jobs:
118138 libunwind-dev \
119139 liblz4-dev
120140
121- - name : Run memory benchmark for commit
141+ - name : Run memory benchmark for commit range - ${{ matrix.build_config.description }}
122142 env :
123143 MEMORY_TRACKER_TOKEN : ${{ secrets.MEMORY_TRACKER_TOKEN }}
124144 run : |
125- COMMIT="${{ matrix.commit }}"
145+ if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
146+ export PATH="$(llvm-config-${{ github.event.inputs.llvm || '18' }} --bindir):$PATH"
147+ fi
148+
149+ # Convert JSON array to A..B format directly from GitHub output
150+ FIRST_COMMIT=$(echo '${{ needs.get-daily-commits.outputs.commits }}' | jq -r '.[0]')
151+ LAST_COMMIT=$(echo '${{ needs.get-daily-commits.outputs.commits }}' | jq -r '.[-1]')
152+ COMMIT_RANGE="${FIRST_COMMIT}..${LAST_COMMIT}"
126153
127- # Build command for single commit
128- CMD="memory-tracker benchmark '$COMMIT '"
154+ # Build command for commit range
155+ CMD="memory-tracker benchmark '$COMMIT_RANGE '"
129156 CMD="$CMD --repo-path ./cpython"
130- CMD="$CMD --binary-id '${{ github.event.inputs. binary_id || 'default' }}'"
131- CMD="$CMD --environment-id '${{ github.event.inputs.environment_id || 'gcc-11 ' }}'"
157+ CMD="$CMD --binary-id '${{ matrix.build_config. binary_id }}'"
158+ CMD="$CMD --environment-id '${{ github.event.inputs.environment_id || 'gh_actions ' }}'"
132159 CMD="$CMD --api-base '${{ github.event.inputs.server_url || 'https://memory.python.org' }}'"
133160 CMD="$CMD --output-dir ./benchmark_results"
161+ CMD="$CMD --configure-flags='${{ matrix.build_config.configure_flags }}'"
134162 CMD="$CMD --force"
135163 CMD="$CMD -vv"
136164
137- echo "Running benchmark for commit: $COMMIT "
165+ echo "Running ${{ matrix.build_config.description }} benchmark for commit range with ${{ needs.get-daily-commits.outputs.commit-count }} commits "
138166 echo "Command: $CMD"
139167 eval $CMD
140168
141169 - name : Upload benchmark results (if failed)
142170 if : failure()
143171 uses : actions/upload-artifact@v4
144172 with :
145- name : benchmark-logs-${{ matrix.commit }}
173+ name : benchmark-logs-${{ matrix.build_config.binary_id }}
146174 path : |
147175 *.log
148176 ./benchmark_results/
@@ -152,12 +180,12 @@ jobs:
152180 if : success()
153181 uses : actions/upload-artifact@v4
154182 with :
155- name : benchmark-results-${{ matrix.commit }}
183+ name : benchmark-results-${{ matrix.build_config.binary_id }}
156184 path : ./benchmark_results/
157185 retention-days : 30
158186
159187 summary :
160- needs : [get-daily-commits, benchmark-commits ]
188+ needs : [get-daily-commits, benchmark-builds ]
161189 if : always()
162190 runs-on : ubuntu-latest
163191
@@ -170,5 +198,6 @@ jobs:
170198 if [ "${{ needs.get-daily-commits.outputs.commit-count }}" = "0" ]; then
171199 echo "No commits found for the target date"
172200 else
173- echo "Benchmark jobs completed with status: ${{ needs.benchmark-commits.result }}"
201+ echo "Benchmark jobs completed with status: ${{ needs.benchmark-builds.result }}"
202+ echo "Binary types benchmarked: default, debug, jit, nogil"
174203 fi
0 commit comments