Skip to content

Commit

Permalink
Fix branch name for perf test on push
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Nov 29, 2024
1 parent f76b8ea commit 73c613c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/perf_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Environment (PR)
- name: Get relevant SHA (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV}
- name: Setup Environment (Push)
- name: Get relevant SHA (Push)
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV}
- run: rake docker_test_perf
- name: Get branch name
shell: bash
run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> ${GITHUB_ENV}
- name: Run perf test
run: rake docker_test_perf
env:
STATS_API_SECRET: ${{ secrets.STATS_API_SECRET }}
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ task docker_test_perf: :docker_build_clang_release do
sh "docker run #{docker_run_flags} " \
"-e STATS_API_SECRET=#{(ENV['STATS_API_SECRET'] || '').inspect} " \
"-e GIT_SHA=#{(ENV['LAST_COMMIT_SHA'] || '').inspect} " \
"-e GIT_REF=#{(ENV['GITHUB_HEAD_REF'] || '').inspect} " \
"-e GIT_BRANCH=#{(ENV['BRANCH'] || '').inspect} " \
'--rm ' \
'--entrypoint rake ' \
"natalie_clang_#{ruby_version_string}_release test_perf"
Expand Down
2 changes: 1 addition & 1 deletion spec/support/test_perf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

stats = {
commit: ENV.fetch('GIT_SHA'),
branch: ENV.fetch('GIT_REF'),
branch: ENV.fetch('GIT_BRANCH'),
ir: totals
}

Expand Down

0 comments on commit 73c613c

Please sign in to comment.