MeiliSearch/.github/workflows/manual_benchmarks.yml

78 lines
3.0 KiB
YAML
Raw Normal View History

2021-05-26 15:57:22 +02:00
name: Benchmarks
on:
workflow_dispatch:
inputs:
dataset_name:
2021-09-13 18:08:28 +02:00
description: 'The name of the dataset used to benchmark (search_songs, search_wiki, search_geo or indexing)'
2021-05-26 15:57:22 +02:00
required: false
default: 'search_songs'
2021-05-26 15:57:22 +02:00
2021-07-19 14:32:31 +02:00
env:
2021-08-25 12:23:02 +02:00
BENCH_NAME: ${{ github.event.inputs.dataset_name }}
2021-07-19 14:32:31 +02:00
2021-05-26 15:57:22 +02:00
jobs:
benchmarks:
name: Run and upload benchmarks
2022-01-04 16:01:01 +01:00
runs-on: benchmarks
timeout-minutes: 4320 # 72h
2021-05-26 15:57:22 +02:00
steps:
- uses: actions/checkout@v3
2021-05-26 15:57:22 +02:00
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# Set variables
- name: Set current branch name
shell: bash
2022-12-01 10:59:20 +01:00
run: echo "name=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
2021-05-26 15:57:22 +02:00
id: current_branch
- name: Set normalized current branch name # Replace `/` by `_` in branch name to avoid issues when pushing to S3
shell: bash
2022-12-01 10:59:20 +01:00
run: echo "name=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" >> $GITHUB_OUTPUT
2021-05-26 15:57:22 +02:00
id: normalized_current_branch
- name: Set shorter commit SHA
shell: bash
2022-12-01 10:59:20 +01:00
run: echo "short=$(echo $GITHUB_SHA | cut -c1-8)" >> $GITHUB_OUTPUT
2021-05-26 15:57:22 +02:00
id: commit_sha
- name: Set file basename with format "dataset_branch_commitSHA"
shell: bash
2022-12-01 10:59:20 +01:00
run: echo "basename=$(echo ${BENCH_NAME}_${{ steps.normalized_current_branch.outputs.name }}_${{ steps.commit_sha.outputs.short }})" >> $GITHUB_OUTPUT
2021-05-26 15:57:22 +02:00
id: file
# Run benchmarks
2021-08-25 12:23:02 +02:00
- name: Run benchmarks - Dataset ${BENCH_NAME} - Branch ${{ steps.current_branch.outputs.name }} - Commit ${{ steps.commit_sha.outputs.short }}
2021-05-26 15:57:22 +02:00
run: |
cd benchmarks
2021-08-25 12:23:02 +02:00
cargo bench --bench ${BENCH_NAME} -- --save-baseline ${{ steps.file.outputs.basename }}
2021-05-26 15:57:22 +02:00
2021-06-01 16:37:57 +02:00
# Generate critcmp files
2021-05-26 15:57:22 +02:00
- name: Install critcmp
uses: taiki-e/install-action@v2
with:
tool: critcmp
2021-05-26 15:57:22 +02:00
- name: Export cripcmp file
run: |
critcmp --export ${{ steps.file.outputs.basename }} > ${{ steps.file.outputs.basename }}.json
# Upload benchmarks
2021-06-01 16:37:57 +02:00
- name: Upload ${{ steps.file.outputs.basename }}.json to DO Spaces # DigitalOcean Spaces = S3
2021-05-26 15:57:22 +02:00
uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.DO_SPACES_ACCESS_KEY }}
secret_key: ${{ secrets.DO_SPACES_SECRET_KEY }}
space_name: ${{ secrets.DO_SPACES_SPACE_NAME }}
space_region: ${{ secrets.DO_SPACES_SPACE_REGION }}
source: ${{ steps.file.outputs.basename }}.json
out_dir: critcmp_results
2021-06-01 16:37:57 +02:00
# Helper
- name: 'README: compare with another benchmark'
run: |
echo "${{ steps.file.outputs.basename }}.json has just been pushed."
echo 'How to compare this benchmark with another one?'
echo ' - Check the available files with: ./benchmarks/scripts/list.sh'
echo " - Run the following command: ./benchmaks/scipts/compare.sh <file-to-compare-with> ${{ steps.file.outputs.basename }}.json"