From 174c3a51487ef1d32625b3a7c985c0d513bb76d9 Mon Sep 17 00:00:00 2001 From: Samuel Burnham <45365069+samuelburnham@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:50:10 -0400 Subject: [PATCH] ci: Fix bugs in `#790` (#822) * Fix bugs in #790 * Address feedback & cleanup --- .github/workflows/bench-deploy.yml | 1 + .github/workflows/merge-tests.yml | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/bench-deploy.yml b/.github/workflows/bench-deploy.yml index 85108420e8..2e0b68dd1e 100644 --- a/.github/workflows/bench-deploy.yml +++ b/.github/workflows/bench-deploy.yml @@ -36,6 +36,7 @@ jobs: run: cargo install cargo-criterion - name: Run benchmarks run: just --dotenv-filename bench.env gpu-bench fibonacci_lem + working-directory: ${{ github.workspace }}/benches # TODO: Prettify labels for easier viewing # Compress the benchmark file and metadata for later analysis - name: Compress artifacts diff --git a/.github/workflows/merge-tests.yml b/.github/workflows/merge-tests.yml index bfd358b8e6..975bac6294 100644 --- a/.github/workflows/merge-tests.yml +++ b/.github/workflows/merge-tests.yml @@ -96,16 +96,22 @@ jobs: path: master # Copy the script so the base can bench with the same parameters - name: Copy source script to base branch - run: cd benches && cp justfile bench.env ../master/benches + run: cp justfile bench.env ../master/benches + working-directory: ${{ github.workspace }}/benches - name: Set base ref variable - run: cd master && echo "BASE_REF=$(git rev-parse HEAD)" >> $GITHUB_ENV - - run: echo ${{ env.BASE_REF }} + run: echo "BASE_REF=$(git rev-parse HEAD)" | tee -a $GITHUB_ENV + working-directory: ${{ github.workspace }}/master - name: Run GPU bench on base branch - run: cd master/benches && just --dotenv-filename bench.env gpu-bench fibonacci_lem + run: just --dotenv-filename bench.env gpu-bench fibonacci_lem + working-directory: ${{ github.workspace }}/master/benches - name: Copy bench output to PR branch - run: cp master/${{ env.BASE_REF }}.json . + run: | + mkdir -p target + cp -r master/target/criterion target + cp master/${{ env.BASE_REF }}.json . - name: Run GPU bench on PR branch - run: cd benches && just --dotenv-filename bench.env gpu-bench fibonacci_lem + run: just --dotenv-filename bench.env gpu-bench fibonacci_lem + working-directory: ${{ github.workspace }}/benches # Create a `criterion-table` and write in commit comment - name: Run `criterion-table` run: cat ${{ github.sha }}.json | criterion-table > BENCHMARKS.md @@ -117,11 +123,10 @@ jobs: # Check for benchmark regression based on Criterion's configured noise threshold - name: Performance regression check id: check-regression - run: | - echo "regress_count=$(grep -c 'Regressed' ${{ github.sha }}.json)" >> $GITHUB_OUTPUT + run: echo "regress_count=$(grep -c 'Regressed' ${{ github.sha }}.json)" | tee -a $GITHUB_OUTPUT # Fail job if regression found - uses: actions/github-script@v6 - if: ${{ steps.check-regression.outputs.regress_count }} > 0 + if: ${{ steps.check-regression.outputs.regress_count > 0 }} with: script: | core.setFailed('Fibonacci bench regression detected')