Integrate ci for running benchmarks #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmarks and build time | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Branch to run benchmark on" | |
required: true | |
default: "main" | |
jobs: | |
Criterion_benchmarks: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'benchmark') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Run json_like_bench | |
if: contains(github.event.pull_request.labels.*.name, 'benchmark') | |
uses: boa-dev/[email protected] | |
with: | |
benchName: json_like_bench | |
defaultFeatures: false | |
branchName: ${{ github.base_ref }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run impl_path_string_for_evaluation_context | |
if: contains(github.event.pull_request.labels.*.name, 'benchmark') | |
uses: boa-dev/[email protected] | |
with: | |
benchName: impl_path_string_for_evaluation_context | |
defaultFeatures: false | |
branchName: ${{ github.base_ref }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run data_loader_bench | |
if: contains(github.event.pull_request.labels.*.name, 'benchmark') | |
uses: boa-dev/[email protected] | |
with: | |
benchName: data_loader_bench | |
defaultFeatures: false | |
branchName: ${{ github.base_ref }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run request_template_bench | |
if: contains(github.event.pull_request.labels.*.name, 'benchmark') | |
uses: boa-dev/[email protected] | |
with: | |
benchName: request_template_bench | |
defaultFeatures: false | |
branchName: ${{ github.base_ref }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check Benchmark Changes | |
if: contains(github.event.pull_request.labels.*.name, 'benchmark') | |
run: | | |
output=$(/home/runner/.cargo/bin/critcmp base changes) | |
echo "$output" | |
awk 'NR > 2 { | |
group=$1 | |
base=$7 | |
changes=$3 | |
gsub(/[^\-0-9\.]/, "", changes) | |
gsub(/[^\-0-9\.]/, "", base) | |
if (changes != "" && base != "") { | |
diff = changes - base | |
percentage = (diff / base) * 100 | |
if (percentage > 10) { | |
printf "Percentage change for %s exceeds 10%%: %.2f%%\n", group, percentage | |
exit 1 | |
} | |
} | |
}' <<< "$output" |