@@ -2,8 +2,8 @@ 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 :
1717 environment_id :
1818 description : ' Environment ID'
1919 required : false
20- default : ' gcc-11 '
20+ default : ' gh_actions '
2121 server_url :
2222 description : ' Memory tracker server URL'
2323 required : false
2626 description : ' CPython repository URL'
2727 required : false
2828 default : ' https://github.com/python/cpython.git'
29+ llvm :
30+ description : ' LLVM version to use for JIT builds'
31+ required : false
32+ default : ' 18'
2933
3034jobs :
3135 get-daily-commits :
@@ -75,15 +79,30 @@ jobs:
7579 echo "$COMMITS"
7680 fi
7781
78- benchmark-commits :
82+ benchmark-builds :
7983 needs : get-daily-commits
8084 if : needs.get-daily-commits.outputs.commit-count > 0
8185 runs-on : ubuntu-latest
8286 strategy :
8387 matrix :
84- commit : ${{ fromJson(needs.get-daily-commits.outputs.commits) }}
88+ build_config :
89+ - binary_id : ' default'
90+ configure_flags : ' -C'
91+ description : ' Default build'
92+ install_deps : ' standard'
93+ - binary_id : ' debug'
94+ configure_flags : ' --with-pydebug'
95+ description : ' Debug build'
96+ install_deps : ' standard'
97+ - binary_id : ' jit'
98+ configure_flags : ' --enable-experimental-jit'
99+ description : ' JIT build'
100+ install_deps : ' jit'
101+ - binary_id : ' nogil'
102+ configure_flags : ' --disable-gil'
103+ description : ' Free-threaded build'
104+ install_deps : ' standard'
85105 fail-fast : false
86- max-parallel : 3
87106
88107 steps :
89108 - name : Checkout memory tracker
@@ -110,6 +129,11 @@ jobs:
110129 # Install CPython dependencies using their script
111130 cd cpython
112131 sudo .github/workflows/posix-deps-apt.sh
132+
133+ # Install JIT dependencies if needed
134+ if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
135+ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ github.event.inputs.llvm || '18' }}
136+ fi
113137
114138 # Install Memray dependencies
115139 sudo apt-get install -y \
@@ -118,31 +142,46 @@ jobs:
118142 libunwind-dev \
119143 liblz4-dev
120144
121- - name : Run memory benchmark for commit
145+ - name : Run memory benchmark for commit range - ${{ matrix.build_config.description }}
122146 env :
123147 MEMORY_TRACKER_TOKEN : ${{ secrets.MEMORY_TRACKER_TOKEN }}
124148 run : |
125- COMMIT="${{ matrix.commit }}"
149+ if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
150+ export PATH="$(llvm-config-${{ github.event.inputs.llvm || '18' }} --bindir):$PATH"
151+ fi
152+
153+ # Pass the entire commit range to the worker
154+ COMMITS="${{ needs.get-daily-commits.outputs.commits }}"
155+
156+ # For manual trigger, check if specific binary_id is provided
157+ if [ -n "${{ github.event.inputs.binary_id }}" ] && [ "${{ github.event.inputs.binary_id }}" != "default" ]; then
158+ # Use the specific binary_id from input if not default
159+ BINARY_ID="${{ github.event.inputs.binary_id }}"
160+ else
161+ # Use the matrix binary_id for scheduled runs or default manual trigger
162+ BINARY_ID="${{ matrix.build_config.binary_id }}"
163+ fi
126164
127- # Build command for single commit
128- CMD="memory-tracker benchmark '$COMMIT '"
165+ # Build command for commit range
166+ CMD="memory-tracker benchmark-range '$COMMITS '"
129167 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 ' }}'"
168+ CMD="$CMD --binary-id '$BINARY_ID '"
169+ CMD="$CMD --environment-id '${{ github.event.inputs.environment_id || 'gh_actions ' }}'"
132170 CMD="$CMD --api-base '${{ github.event.inputs.server_url || 'https://memory.python.org' }}'"
133171 CMD="$CMD --output-dir ./benchmark_results"
172+ CMD="$CMD --configure-flags='${{ matrix.build_config.configure_flags }}'"
134173 CMD="$CMD --force"
135174 CMD="$CMD -vv"
136175
137- echo "Running benchmark for commit: $COMMIT "
176+ echo "Running ${{ matrix.build_config.description }} benchmark for commit range with ${{ needs.get-daily-commits.outputs.commit-count }} commits "
138177 echo "Command: $CMD"
139178 eval $CMD
140179
141180 - name : Upload benchmark results (if failed)
142181 if : failure()
143182 uses : actions/upload-artifact@v4
144183 with :
145- name : benchmark-logs-${{ matrix.commit }}
184+ name : benchmark-logs-${{ matrix.build_config.binary_id }}
146185 path : |
147186 *.log
148187 ./benchmark_results/
@@ -152,12 +191,12 @@ jobs:
152191 if : success()
153192 uses : actions/upload-artifact@v4
154193 with :
155- name : benchmark-results-${{ matrix.commit }}
194+ name : benchmark-results-${{ matrix.build_config.binary_id }}
156195 path : ./benchmark_results/
157196 retention-days : 30
158197
159198 summary :
160- needs : [get-daily-commits, benchmark-commits ]
199+ needs : [get-daily-commits, benchmark-builds ]
161200 if : always()
162201 runs-on : ubuntu-latest
163202
@@ -170,5 +209,6 @@ jobs:
170209 if [ "${{ needs.get-daily-commits.outputs.commit-count }}" = "0" ]; then
171210 echo "No commits found for the target date"
172211 else
173- echo "Benchmark jobs completed with status: ${{ needs.benchmark-commits.result }}"
212+ echo "Benchmark jobs completed with status: ${{ needs.benchmark-builds.result }}"
213+ echo "Binary types benchmarked: default, debug, jit, nogil"
174214 fi
0 commit comments