Skip to content

Commit

Permalink
ci: fix benchmarks status reporting (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamogbz committed Jun 3, 2021
1 parent 3887151 commit 25d8fcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@ jobs:
invoke release --dry-run
- name: Benchmark
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Github pull request event has the merge commit as the HEAD on checkout
# https://github.com/actions/checkout/issues/261
COMMIT_SHA: ${{ github.event.after }}
run: |
. $VENV/bin/activate
invoke benchmark
invoke benchmark --report
release:
name: Release
runs-on: ubuntu-latest
Expand Down Expand Up @@ -137,6 +142,7 @@ jobs:
- name: Benchmark
env:
GH_TOKEN: ${{ secrets.TOPHAT_BOT_GH_TOKEN }}
COMMIT_SHA: ${{ env.GITHUB_SHA }}
run: |
. $VENV/bin/activate
invoke benchmark --report
6 changes: 3 additions & 3 deletions benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_commit(github: "Github") -> "Commit":
"""
Get current commit the github ci run is for
"""
github_sha = get_req_env("GITHUB_SHA")
github_sha = get_req_env("COMMIT_SHA")
return github.get_repo(GH_REPO).get_commit(github_sha)


Expand All @@ -63,7 +63,7 @@ def get_target_url() -> str:
"""
repo_url = f"https://github.com/{GH_REPO}"
all_results_url = f"{repo_url}/tree/{GH_BENCH_BRANCH}/{GH_BENCH_FILE_PATH}"
commit_sha = get_req_env("GITHUB_SHA")
commit_sha = get_req_env("COMMIT_SHA")
return all_results_url + (f"/{commit_sha}" if commit_sha else "")


Expand Down Expand Up @@ -102,7 +102,7 @@ def measure_perf(
if not github:
return
repo = github.get_repo(GH_REPO)
commit_sha = get_req_env("GITHUB_SHA")
commit_sha = get_req_env("COMMIT_SHA")
with open(BENCH_PERF_FILE, "r", encoding="utf-8") as bench_file:
try:
repo.create_file(
Expand Down

0 comments on commit 25d8fcb

Please sign in to comment.