Skip to content

Commit

Permalink
ci: fix benchmark reporting on master (#513)
Browse files Browse the repository at this point in the history
* ci: fix benchmark reporting on master

* ci(debug): print github event json

* Revert "ci(debug): print github event json"

This reverts commit db22e95.

* ci: setup env COMMIT_SHA when detecting python version

* ci(debug): print env

* ci(debug): print env

* ci(debug): revert superfluous changes
  • Loading branch information
iamogbz authored Jun 5, 2021
1 parent 67ef6ca commit 2695a44
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .github/actions/detect-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: detect-env
runs:
using: "composite"
steps:
- name: Determine Python Version
run: echo PYTHON_VERSION=$(cat .python-version | tr -d '\n') >> $GITHUB_ENV
shell: bash
- name: Determine Commit Sha
# Github pull request event has the merge commit as the HEAD on checkout
# https://github.com/actions/checkout/issues/261
run: echo COMMIT_SHA=$(jq -r ".pull_request.head.sha // .check_run.head_sha // .after" $GITHUB_EVENT_PATH) >> $GITHUB_ENV
shell: bash
7 changes: 0 additions & 7 deletions .github/actions/detect-python/action.yml

This file was deleted.

12 changes: 4 additions & 8 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/detect-python
- uses: ./.github/actions/detect-env
- name: Setup Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
SKIP_DEPS: 1
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/detect-python
- uses: ./.github/actions/detect-env
- name: Setup Python
uses: actions/setup-python@v2
with:
Expand All @@ -81,7 +81,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/detect-python
- uses: ./.github/actions/detect-env
- name: Setup Python
uses: actions/setup-python@v2
with:
Expand All @@ -98,9 +98,6 @@ jobs:
- name: Benchmark
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 --report
Expand All @@ -114,7 +111,7 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/detect-python
- uses: ./.github/actions/detect-env
- name: Setup Python
uses: actions/setup-python@v2
with:
Expand All @@ -140,7 +137,6 @@ jobs:
- name: Benchmark
env:
GH_TOKEN: ${{ secrets.TOPHAT_BOT_GH_TOKEN }}
COMMIT_SHA: ${{ env.GITHUB_SHA }}
run: |
. $VENV/bin/activate
invoke benchmark --report
4 changes: 2 additions & 2 deletions benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def get_commit(github: "Github") -> "Commit":
"""
Get current commit the github ci run is for
"""
github_sha = get_req_env("COMMIT_SHA")
return github.get_repo(GH_REPO).get_commit(github_sha)
commit_sha = get_req_env("COMMIT_SHA")
return github.get_repo(GH_REPO).get_commit(commit_sha)


def get_branch() -> Optional[str]:
Expand Down

0 comments on commit 2695a44

Please sign in to comment.