From 575c2b89ed1f0c3d5e298cd3f1de5db97131f734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Sun, 17 Sep 2023 16:38:08 +0300 Subject: [PATCH] Generate whisker plot via CI --- .github/workflows/benchmark.yml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 52b0364..f45c672 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -28,3 +28,40 @@ jobs: - name: Run benchmarks shell: bash run: ./bench.sh + + - name: Generate plot + shell: bash + run: | + wget https://raw.githubusercontent.com/sharkdp/hyperfine/master/scripts/plot_whisker.py + python -m pip install -U matplotlib + python plot_whisker.py benchmarks.json -o benchmarks.png + + - name: Upload output + uses: actions/upload-artifact@v3 + with: + name: benchmark-output + path: benchmarks.* + + - name: Checkout output branch + uses: actions/checkout@v3 + if: github.event_name != 'pull_request' + with: + ref: output + fetch-depth: 1 + + - name: Download output + uses: actions/download-artifact@v3 + if: github.event_name != 'pull_request' + with: + name: benchmark-output + + - name: Commit to the branch + if: github.event_name != 'pull_request' + shell: bash + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + set +e + git add benchmarks.* + git commit -m "Update benchmarks" + git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git output