From adcd848809647c7167f23b0612c8e69452ed0beb Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Mon, 4 Mar 2024 23:03:26 +0100 Subject: [PATCH] CI: Add bench workflows --- .github/workflows/bench-manual.yml | 30 +++++++++++++++ .github/workflows/bench-pr.yml | 46 +++++++++++++++++++++++ .github/workflows/bench-push-indexing.yml | 25 ++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 .github/workflows/bench-manual.yml create mode 100644 .github/workflows/bench-pr.yml create mode 100644 .github/workflows/bench-push-indexing.yml diff --git a/.github/workflows/bench-manual.yml b/.github/workflows/bench-manual.yml new file mode 100644 index 000000000..6d8c3a006 --- /dev/null +++ b/.github/workflows/bench-manual.yml @@ -0,0 +1,30 @@ +name: Bench (manual) + +on: + workflow_dispatch: + inputs: + workload: + description: 'The path to the workloads to execute (workloads/...)' + required: true + default: 'workloads/movies.json' + +env: + WORKLOAD_NAME: ${{ github.event.inputs.workload }} + +jobs: + benchmarks: + name: Run and upload benchmarks + runs-on: benchmarks + timeout-minutes: 180 # 3h + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Run benchmarks - workload ${WORKLOAD_NAME} - branch ${{ github.ref }} - commit ${{ github.sha }} + run: | + cargo xtask bench --api-key "${{ secrets.BENCHMARK_API_KEY }}" --dashboard-url "${{ vars.BENCHMARK_DASHBOARD_URL }}" --reason "Manual [Run #${{ github.run_id }}](https://github.com/meilisearch/meilisearch/actions/runs/${{ github.run_id }})" -- ${WORKLOAD_NAME} + diff --git a/.github/workflows/bench-pr.yml b/.github/workflows/bench-pr.yml new file mode 100644 index 000000000..6f4956542 --- /dev/null +++ b/.github/workflows/bench-pr.yml @@ -0,0 +1,46 @@ +name: Bench (PR) +on: + issue_comment: + types: [created] + +permissions: + issues: write + +env: + GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }} + +jobs: + run-benchmarks-on-comment: + if: startsWith(github.event.comment.body, '/bench') + name: Run and upload benchmarks + runs-on: benchmarks + timeout-minutes: 180 # 3h + steps: + - name: Check for Command + id: command + uses: xt0rted/slash-command-action@v2 + with: + command: bench + reaction-type: "rocket" + repo-token: ${{ env.GH_TOKEN }} + + - uses: xt0rted/pull-request-comment-branch@v2 + id: comment-branch + with: + repo_token: ${{ env.GH_TOKEN }} + + - uses: actions/checkout@v3 + if: success() + with: + fetch-depth: 0 # fetch full history to be able to get main commit sha + ref: ${{ steps.comment-branch.outputs.head_ref }} + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Run benchmarks on PR ${{ github.event.issue.id }} + run: | + cargo xtask bench --api-key "${{ secrets.BENCHMARK_API_KEY }}" --dashboard-url "${{ vars.BENCHMARK_DASHBOARD_URL }}" --reason "[Comment](${{ github.event.comment.url }}) on [#${{github.event.issue.id}}](${{ github.event.issue.url }})" -- ${{ steps.command.outputs.command-arguments }} \ No newline at end of file diff --git a/.github/workflows/bench-push-indexing.yml b/.github/workflows/bench-push-indexing.yml new file mode 100644 index 000000000..fd0f19a5a --- /dev/null +++ b/.github/workflows/bench-push-indexing.yml @@ -0,0 +1,25 @@ +name: Indexing bench (push) + +on: + push: + branches: + - main + +jobs: + benchmarks: + name: Run and upload benchmarks + runs-on: benchmarks + timeout-minutes: 180 # 3h + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + # Run benchmarks + - name: Run benchmarks - Dataset ${BENCH_NAME} - Branch main - Commit ${{ github.sha }} + run: | + cargo xtask bench --api-key "${{ secrets.BENCHMARK_API_KEY }}" --dashboard-url "${{ vars.BENCHMARK_DASHBOARD_URL }}" --reason "Push on `main` [Run #${{ github.run_id }}](https://github.com/meilisearch/meilisearch/actions/runs/${{ github.run_id }})" -- workloads/*.json +