Skip to content

Commit ec7ba81

Browse files
Copilothsluoyz
andcommitted
Address code review feedback - add env var, comments, and null checks
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
1 parent e3de4ae commit ec7ba81

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ permissions:
2626
jobs:
2727
benchmark:
2828
runs-on: ubuntu-latest
29+
env:
30+
BENCHMARK_PATH: tests/benchmarks/
2931
steps:
3032
- name: Checkout PR branch
3133
uses: actions/checkout@v4
@@ -46,7 +48,7 @@ jobs:
4648
--benchmark-only \
4749
--benchmark-json=pr-benchmark.json \
4850
--benchmark-columns=mean,stddev,iqr,ops,rounds \
49-
tests/benchmarks/
51+
${{ env.BENCHMARK_PATH }}
5052
5153
- name: Store PR benchmark result
5254
uses: actions/upload-artifact@v4
@@ -70,14 +72,15 @@ jobs:
7072
--benchmark-only \
7173
--benchmark-json=base-benchmark.json \
7274
--benchmark-columns=mean,stddev,iqr,ops,rounds \
73-
tests/benchmarks/
75+
${{ env.BENCHMARK_PATH }}
7476
7577
- name: Store base benchmark result
7678
uses: actions/upload-artifact@v4
7779
with:
7880
name: base-benchmark
7981
path: base-benchmark.json
8082

83+
# Checkout PR branch again to ensure artifact downloads happen in correct context
8184
- name: Checkout PR branch again
8285
uses: actions/checkout@v4
8386

@@ -172,8 +175,14 @@ jobs:
172175
comment += '\n---\n';
173176
comment += `**Base Branch:** \`${context.payload.pull_request.base.ref}\` (${context.payload.pull_request.base.sha.substring(0, 7)})\n`;
174177
comment += `**PR Branch:** \`${context.payload.pull_request.head.ref}\` (${context.payload.pull_request.head.sha.substring(0, 7)})\n`;
175-
comment += `**Python Version:** ${prBenchmark.machine_info.python_version}\n`;
176-
comment += `**Platform:** ${prBenchmark.machine_info.system} ${prBenchmark.machine_info.release}\n`;
178+
if (prBenchmark.machine_info) {
179+
if (prBenchmark.machine_info.python_version) {
180+
comment += `**Python Version:** ${prBenchmark.machine_info.python_version}\n`;
181+
}
182+
if (prBenchmark.machine_info.system && prBenchmark.machine_info.release) {
183+
comment += `**Platform:** ${prBenchmark.machine_info.system} ${prBenchmark.machine_info.release}\n`;
184+
}
185+
}
177186
178187
// Post comment
179188
await github.rest.issues.createComment({

0 commit comments

Comments
 (0)