From 73c613c143accc521a6f0f15dd6e1eb6560c78fb Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Fri, 29 Nov 2024 08:08:33 -0600 Subject: [PATCH] Fix branch name for perf test on push --- .github/workflows/perf_test.yml | 10 +++++++--- Rakefile | 2 +- spec/support/test_perf.rb | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/perf_test.yml b/.github/workflows/perf_test.yml index a4788eaa19..531399012c 100644 --- a/.github/workflows/perf_test.yml +++ b/.github/workflows/perf_test.yml @@ -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 }} diff --git a/Rakefile b/Rakefile index 450855b81e..29f90c09a5 100644 --- a/Rakefile +++ b/Rakefile @@ -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" diff --git a/spec/support/test_perf.rb b/spec/support/test_perf.rb index 93fb39ad45..1271fc6d78 100644 --- a/spec/support/test_perf.rb +++ b/spec/support/test_perf.rb @@ -26,7 +26,7 @@ stats = { commit: ENV.fetch('GIT_SHA'), - branch: ENV.fetch('GIT_REF'), + branch: ENV.fetch('GIT_BRANCH'), ir: totals }