diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index b9825349158..9ed9b5581e4 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -41,13 +41,17 @@ jobs: with: fetch-depth: 0 - - name: Checkout pull/${{ github.event.number }} + - name: Checkout PR and master branch uses: actions/checkout@v4 with: - ref: ${{ github.sha }} + ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 if: github.event_name == 'pull_request_target' + - name: Fetch master branch + run: git fetch origin master:master + if: github.event_name == 'pull_request_target' + - name: Setup LFS uses: ./.github/actions/setup_lfs @@ -101,9 +105,8 @@ jobs: - name: Run benchmarks for base and head commits of PR if: github.event_name == 'pull_request_target' run: | - echo ${{ github.event.pull_request.base.sha }} > commit_hashes.txt - echo ${{ github.event.pull_request.head.sha }} >> commit_hashes.txt - + echo $(git rev-parse HEAD) > commit_hashes.txt + echo $(git rev-parse master) >> commit_hashes.txt asv run -a repeat=2 -a rounds=1 HASHFILE:commit_hashes.txt | tee asv-output-PR.log if grep -q failed asv-output-PR.log; then echo "Some benchmarks have failed!" @@ -111,10 +114,10 @@ jobs: fi - name: Compare Master and PR head - run: asv compare ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --config asv.conf.json | tee asv-compare-output.log + run: asv compare origin/master HEAD --config asv.conf.json | tee asv-compare-output.log - name: Compare Master and PR head but only show changed results - run: asv compare ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --only-changed --config asv.conf.json | tee asv-compare-changed-output.log + run: asv compare origin/master HEAD --only-changed --config asv.conf.json | tee asv-compare-changed-output.log - name: Benchmarks compare output id: asv_pr_vs_master