|
| 1 | +name: Benchmarks search wikipedia articles (cron) |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "30 16 * * FRI" # every friday at 16:30 (it’s snacky snack-time!) |
| 6 | + |
| 7 | +env: |
| 8 | + BENCH_NAME: "search_wiki" |
| 9 | + |
| 10 | +jobs: |
| 11 | + benchmarks: |
| 12 | + name: Run and upload benchmarks |
| 13 | + runs-on: self-hosted |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + - uses: actions-rs/toolchain@v1 |
| 17 | + with: |
| 18 | + profile: minimal |
| 19 | + toolchain: stable |
| 20 | + override: true |
| 21 | + |
| 22 | + # Set variables |
| 23 | + - name: Set current branch name |
| 24 | + shell: bash |
| 25 | + run: echo "##[set-output name=name;]$(echo ${GITHUB_REF#refs/heads/})" |
| 26 | + id: current_branch |
| 27 | + - name: Set normalized current branch name # Replace `/` by `_` in branch name to avoid issues when pushing to S3 |
| 28 | + shell: bash |
| 29 | + run: echo "##[set-output name=name;]$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" |
| 30 | + id: normalized_current_branch |
| 31 | + - name: Set shorter commit SHA |
| 32 | + shell: bash |
| 33 | + run: echo "##[set-output name=short;]$(echo $GITHUB_SHA | cut -c1-8)" |
| 34 | + id: commit_sha |
| 35 | + - name: Set file basename with format "dataset_branch_commitSHA" |
| 36 | + shell: bash |
| 37 | + run: echo "##[set-output name=basename;]$(echo ${BENCH_NAME}${{ steps.normalized_current_branch.outputs.name }}_${{ steps.commit_sha.outputs.short }})" |
| 38 | + id: file |
| 39 | + |
| 40 | + # Run benchmarks |
| 41 | + - name: Run benchmarks - Dataset ${BENCH_NAME} - Branch ${{ steps.current_branch.outputs.name }} - Commit ${{ steps.commit_sha.outputs.short }} |
| 42 | + run: | |
| 43 | + cd benchmarks |
| 44 | + cargo bench --bench ${BENCH_NAME} -- --save-baseline ${{ steps.file.outputs.basename }} |
| 45 | +
|
| 46 | + # Generate critcmp files |
| 47 | + - name: Install critcmp |
| 48 | + run: cargo install critcmp |
| 49 | + - name: Export cripcmp file |
| 50 | + run: | |
| 51 | + critcmp --export ${{ steps.file.outputs.basename }} > ${{ steps.file.outputs.basename }}.json |
| 52 | +
|
| 53 | + # Upload benchmarks |
| 54 | + - name: Upload ${{ steps.file.outputs.basename }}.json to DO Spaces # DigitalOcean Spaces = S3 |
| 55 | + uses: BetaHuhn/do-spaces-action@v2 |
| 56 | + with: |
| 57 | + access_key: ${{ secrets.DO_SPACES_ACCESS_KEY }} |
| 58 | + secret_key: ${{ secrets.DO_SPACES_SECRET_KEY }} |
| 59 | + space_name: ${{ secrets.DO_SPACES_SPACE_NAME }} |
| 60 | + space_region: ${{ secrets.DO_SPACES_SPACE_REGION }} |
| 61 | + source: ${{ steps.file.outputs.basename }}.json |
| 62 | + out_dir: critcmp_results |
| 63 | + |
| 64 | + # Helper |
| 65 | + - name: 'README: compare with another benchmark' |
| 66 | + run: | |
| 67 | + echo "${{ steps.file.outputs.basename }}.json has just been pushed." |
| 68 | + echo 'How to compare this benchmark with another one?' |
| 69 | + echo ' - Check the available files with: ./benchmarks/scripts/list.sh' |
| 70 | + echo " - Run the following command: ./benchmaks/scipts/compare.sh <file-to-compare-with> ${{ steps.file.outputs.basename }}.json" |
0 commit comments