forked from rems-project/cerberus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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] | ||
|
@@ -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() | ||
}); |