perf(ci): initial GH action to run benchmark vs. external pools
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 18 Sep 2023 10:06:26 +0000 (12:06 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 18 Sep 2023 10:06:26 +0000 (12:06 +0200)
Reference: #106

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.github/workflows/combine-prs.yml
.github/workflows/external-benchmark.yml [new file with mode: 0644]
.github/workflows/generate-documentation.yml
.github/workflows/internal-benchmark.yml [moved from .github/workflows/benchmark.yml with 98% similarity]
benchmarks/versus-external-pools/bench.sh

index 3cf3ffebfbd3c3e04d0d7df29cca0404b685b8e7..813a1e3fcd6ad3a7aa151d112ab3351b56e85b90 100644 (file)
@@ -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 (file)
index 0000000..1f1bf80
--- /dev/null
@@ -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 }}
index fcf24a47cfed428fbe8c38ed8b2efe139520dfa4..f3d4ae4e428b116ce26bbb184f1263ed3b41eb59 100644 (file)
@@ -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 }}'
similarity index 98%
rename from .github/workflows/benchmark.yml
rename to .github/workflows/internal-benchmark.yml
index 393dc941b9a12f03cbbb683cca17155f4a916d99..46ec1d8f4cce3475bc6d0a0a1919a0c85193ee6b 100644 (file)
@@ -1,4 +1,4 @@
-name: Benchmark
+name: Internal benchmark
 
 on:
   workflow_dispatch:
index 7221ba32e538c089e88636a855a7ea2681b1df76..7d7e9651469252304dec4145adcb42c858f88bd6 100755 (executable)
@@ -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"