A GitHub Action for reporting benchmark data and comparing it against a baseline.
This action reads benchmark metrics on GitHub pull requests and commits, and reports them by adding a comment with any metrics found. It also compares then against the latest commit on the main branch, treating it as the baseline.
The action looks for benchmark data in files on the repository root. These should be named in the format
.delta.<metric name>
— e.g. .delta.install_time
will create a metric called install_time
.
These files should contain:
- A number representing the value of the metric
- The units of the metric (optional)
- A human-friendly name of the metric (optional)
Example: .delta.install_time
350ms (Installation time)
The units will determine how the values will be formatted in the benchmark reports. Supported units are:
- Time (formatted with
pretty-ms
)ms
/milliseconds
s
/seconds
- Storage (formatted with
pretty-bytes
)b
/bytes
kb
/kilobytes
- Unitless (formatted with
Number.prototype.toLocaleString
)
The action supports the following optional inputs:
Name | Description | Default |
---|---|---|
base_branch |
Name of the base branch, if not auto detected | autodetect |
title |
Title/heading to include in the comments | Delta results |
token |
GitHub access token | GITHUB_TOKEN |
pr_number |
The PR this run is associated with (for workflow_run ) |
autodetect |
style |
The rendering style to use when commenting on PRs (options: text, graph) | graph |
- Add a benchmark step to your workflow that creates a
.delta.<metric>
file with the format described above
- name: Run benchmark
run: echo 123ms > .delta.install_time
-
Add the action to the workflow
- name: Delta uses: netlify/delta-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }}
Please see CONTRIBUTING.md for instructions on how to set up and work on this repository. Thanks for contributing!