From 27c3ac595f7b4513deecd1953a7bc09e119545f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 18 Sep 2023 12:06:26 +0200 Subject: [PATCH] perf(ci): initial GH action to run benchmark vs. external pools MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reference: #106 Signed-off-by: Jérôme Benoit --- .github/workflows/combine-prs.yml | 2 +- .github/workflows/external-benchmark.yml | 48 +++++++++++++++++++ .github/workflows/generate-documentation.yml | 10 ++-- .../{benchmark.yml => internal-benchmark.yml} | 2 +- benchmarks/versus-external-pools/bench.sh | 2 +- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/external-benchmark.yml rename .github/workflows/{benchmark.yml => internal-benchmark.yml} (98%) diff --git a/.github/workflows/combine-prs.yml b/.github/workflows/combine-prs.yml index 3cf3ffeb..813a1e3f 100644 --- a/.github/workflows/combine-prs.yml +++ b/.github/workflows/combine-prs.yml @@ -3,7 +3,7 @@ name: Combine PRs on: workflow_dispatch: schedule: - - cron: '0 0 * * *' + - cron: '0 2 * * *' permissions: contents: write diff --git a/.github/workflows/external-benchmark.yml b/.github/workflows/external-benchmark.yml new file mode 100644 index 00000000..1f1bf80e --- /dev/null +++ b/.github/workflows/external-benchmark.yml @@ -0,0 +1,48 @@ +name: External benchmark + +on: + workflow_dispatch: + schedule: + - cron: '0 3 * * *' + +jobs: + external-benchmark: + if: github.repository == 'poolifier/poolifier' + name: External benchmark + runs-on: [self-hosted, external-benchmark] + defaults: + run: + working-directory: benchmarks/versus-external-pools + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + cache: 'pnpm' + - name: Install dependencies + run: pnpm install --ignore-scripts + - name: Run benchmark + if: github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' + run: ./bench.sh + - name: Commit files + if: github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' + env: + COMMIT_MESSAGE: 'docs: update benchmark versus external pools results' + COMMIT_AUTHOR: Benchmark Bot + COMMIT_EMAIL: benchmark-bot@users.noreply.github.com + run: | + git config --local user.name "${{ env.COMMIT_AUTHOR }}" + git config --local user.email "${{ env.COMMIT_EMAIL }}" + git commit -a -m "${{ env.COMMIT_MESSAGE }}" + - name: Push changes + if: github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' + uses: CasperWA/push-protected@v2 + with: + token: ${{ secrets.GH_TOKEN_PROTECTED }} + branch: ${{ github.event.repository.default_branch }} diff --git a/.github/workflows/generate-documentation.yml b/.github/workflows/generate-documentation.yml index fcf24a47..f3d4ae4e 100644 --- a/.github/workflows/generate-documentation.yml +++ b/.github/workflows/generate-documentation.yml @@ -29,11 +29,15 @@ jobs: - name: Commit files if: github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' + env: + COMMIT_MESSAGE: 'docs: generate documentation' + COMMIT_AUTHOR: Documentation Bot + COMMIT_EMAIL: documentation-bot@users.noreply.github.com run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" + git config --local user.name "${{ env.COMMIT_AUTHOR }}" + git config --local user.email "${{ env.COMMIT_EMAIL }}" git add ./docs - git commit -m "docs: generate documentation" -a + git commit -a -m "${{ env.COMMIT_MESSAGE }}" - name: Push changes if: github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' diff --git a/.github/workflows/benchmark.yml b/.github/workflows/internal-benchmark.yml similarity index 98% rename from .github/workflows/benchmark.yml rename to .github/workflows/internal-benchmark.yml index 393dc941..46ec1d8f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/internal-benchmark.yml @@ -1,4 +1,4 @@ -name: Benchmark +name: Internal benchmark on: workflow_dispatch: diff --git a/benchmarks/versus-external-pools/bench.sh b/benchmarks/versus-external-pools/bench.sh index 7221ba32..7d7e9651 100755 --- a/benchmarks/versus-external-pools/bench.sh +++ b/benchmarks/versus-external-pools/bench.sh @@ -51,7 +51,7 @@ case "$OSTYPE" in caffeinate ./hyperfine_benchmarks.sh ;; linux*) - systemd-inhibit ./hyperfine_benchmarks.sh + systemd-inhibit --what=idle ./hyperfine_benchmarks.sh ;; *) echo "Unsupported $OSTYPE" -- 2.34.1