Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
jprider63 committed Aug 27, 2024
1 parent ea9e9c3 commit 9cd3646
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci-pr-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ jobs:
- name: Run benchmark on PR
run: |
echo "PR_DATA=$(mktemp)" >> $GITHUB_ENV
echo "BASE_DATA=$(mktemp)" >> $GITHUB_ENV
echo "COMMENT=$(mktemp)" >> $GITHUB_ENV
opam switch ${{ matrix.version }}
eval $(opam env --switch=${{ matrix.version }})
cd tests; USE_OPAM='' ./run-ci-benchmarks.sh; mv benchmark-data.json benchmark-data-pr.json
cd tests; USE_OPAM='' ./run-ci-benchmarks.sh; mv benchmark-data.json ${{ env.PR_DATA }}
cd ..
- name: Switch to target branch
Expand All @@ -120,15 +123,16 @@ jobs:
run: |
opam switch ${{ matrix.version }}
eval $(opam env --switch=${{ matrix.version }})
cd tests; USE_OPAM='' ./run-ci-benchmarks.sh; mv benchmark-data.json benchmark-data-baseline.json
cd tests; USE_OPAM='' ./run-ci-benchmarks.sh; mv benchmark-data.json ${{ env.BASE_DATA }}
cd ..
- name: Compare results
run: |
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
echo 'Benchmark comparison for [`${{ env.HEAD_SHA }}`](${{ github.event.repository.html_url }}/commit/${{ github.event.pull_request.head.sha }}) (PR) vs [`${{ env.BASE_SHA }}`](${{ github.event.repository.html_url }}/commit/${{ github.event.pull_request.base.sha }}) (baseline).' >> tests/benchmark-comparison.txt
tests/compare-benchmarks.py tests/benchmark-data-baseline.json tests/benchmark-data-pr.json >> tests/benchmark-comparison.txt
echo 'Benchmark comparison for [`${{ env.HEAD_SHA }}`](${{ github.event.repository.html_url }}/commit/${{ github.event.pull_request.head.sha }}) (PR) vs [`${{ env.BASE_SHA }}`](${{ github.event.repository.html_url }}/commit/${{ github.event.pull_request.base.sha }}) (baseline).' >> ${{ env.COMMENT }}
git checkout ${{ github.event.pull_request.head.sha }}
tests/compare-benchmarks.py ${{ env.BASE_DATA }} ${{ env.PR_DATA }} >> ${{ env.COMMENT }}
- name: 'Comment PR'
uses: actions/[email protected]
Expand All @@ -139,5 +143,5 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: require('fs').readFileSync('tests/benchmark-comparison.txt').toString()
body: require('fs').readFileSync('${{ env.COMMENT }}').toString()
});

0 comments on commit 9cd3646

Please sign in to comment.