2727 required : false
2828 default : ' 19'
2929
30+ permissions :
31+ contents : read
32+
3033jobs :
3134 benchmark-builds :
3235 runs-on : ubuntu-latest
5861 steps :
5962 - name : Checkout memory tracker
6063 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
64+ with :
65+ persist-credentials : false
6166
6267 - name : Set up Python
6368 uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
@@ -66,13 +71,13 @@ jobs:
6671
6772 - name : Clone CPython repository and get commits
6873 run : |
69- git clone ${{ github.event.inputs.cpython_repo || 'https://github.com/python/cpython.git' }} cpython
74+ git clone "${GITHUB_EVENT_INPUTS_CPYTHON_REPO}" cpython
7075 cd cpython
7176 git fetch --all
7277
7378 # Determine target date
74- if [ -n "${{ github.event.inputs.target_date } }" ]; then
75- TARGET_DATE="${{ github.event.inputs.target_date } }"
79+ if [ -n "${GITHUB_EVENT_INPUTS_TARGET_DATE }" ]; then
80+ TARGET_DATE="${GITHUB_EVENT_INPUTS_TARGET_DATE }"
7681 else
7782 TARGET_DATE=$(date -u +%Y-%m-%d)
7883 fi
9297
9398 echo "Commit to benchmark: $LAST_COMMIT"
9499 fi
100+ env :
101+ GITHUB_EVENT_INPUTS_TARGET_DATE : ${{ github.event.inputs.target_date }}
102+ GITHUB_EVENT_INPUTS_CPYTHON_REPO : ${{ github.event.inputs.cpython_repo || 'https://github.com/python/cpython.git' }}
95103
96104 - name : Print environment variables
97105 run : |
@@ -110,14 +118,16 @@ jobs:
110118 pip install -e .
111119
112120 - name : Install build dependencies
121+ env :
122+ LLVM_VERSION : ${{ github.event.inputs.llvm || '19' }}
113123 run : |
114124 # Install CPython dependencies using their script
115125 cd cpython
116126 sudo .github/workflows/posix-deps-apt.sh
117127
118128 # Install JIT dependencies if needed
119129 if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
120- sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ github.event.inputs.llvm || '19' }}
130+ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh "${LLVM_VERSION}"
121131 fi
122132
123133 # Install Memray dependencies
@@ -130,20 +140,22 @@ jobs:
130140 - name : Run memory benchmark for commit range - ${{ matrix.build_config.description }}
131141 env :
132142 MEMORY_TRACKER_TOKEN : ${{ secrets.MEMORY_TRACKER_TOKEN }}
143+ LLVM_VERSION : ${{ github.event.inputs.llvm || '19' }}
144+ ENVIRONMENT_ID : ${{ github.event.inputs.environment_id || 'gh_actions' }}
145+ SERVER_URL : ${{ github.event.inputs.server_url || 'https://memory.python.org' }}
133146 run : |
134147 if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
135- export PATH="$(llvm-config-${{ github.event.inputs.llvm || '19' }} --bindir):$PATH"
136- export LLVM_VERSION="${{ github.event.inputs.llvm || '19' }}"
137- echo "LLVM Path: $(llvm-config-${{ github.event.inputs.llvm || '19' }} --bindir)"
138- echo "Clang version: $(clang-${{ github.event.inputs.llvm || '19' }} --version || echo 'clang-${{ github.event.inputs.llvm || '19' }} not found')"
148+ export PATH="$(llvm-config-${LLVM_VERSION} --bindir):$PATH"
149+ echo "LLVM Path: $(llvm-config-${LLVM_VERSION} --bindir)"
150+ echo "Clang version: $(clang-${LLVM_VERSION} --version || echo "clang-${LLVM_VERSION} not found")"
139151 fi
140152
141153 # Build command for commit range
142154 memory-tracker benchmark "$COMMIT_RANGE" \
143155 --repo-path ./cpython \
144156 --binary-id "${{ matrix.build_config.binary_id }}" \
145- --environment-id "${{ github.event.inputs.environment_id || 'gh_actions' } }" \
146- --api-base "${{ github.event.inputs.server_url || 'https://memory.python.org' } }" \
157+ --environment-id "${ENVIRONMENT_ID }" \
158+ --api-base "${SERVER_URL }" \
147159 --output-dir ./benchmark_results \
148160 --configure-flags="${{ matrix.build_config.configure_flags }}" \
149161 --force \
@@ -176,5 +188,7 @@ jobs:
176188 - name : Print summary
177189 run : |
178190 echo "Daily benchmark run completed"
179- echo "Benchmark jobs completed with status: ${{ needs.benchmark-builds.result }}"
180- echo "Binary types benchmarked: default, debug, jit, lto-pgo, nogil"
191+ echo "Benchmark jobs completed with status: ${NEEDS_BENCHMARK_BUILDS_RESULT}"
192+ echo "Binary types benchmarked: default, debug, jit, lto-pgo, nogil"
193+ env :
194+ NEEDS_BENCHMARK_BUILDS_RESULT : ${{ needs.benchmark-builds.result }}
0 commit comments