Read our detailed post on how CI noise affects benchmark
consistency.
Setup
For now, only the following OS and versions are supported on the runners:
- Ubuntu 22.04 and later
- Debian 12 and later
1. Allow the Gitlab CI workflow to upload on CodSpeed
You need to get your CodSpeed Token. There are multiple ways to retrieve it:- Once you enable a repository on CodSpeed, you’ll be prompted to copy the token
- You can also find it on the repository settings page

Be mindful that a token is scoped to a specific repository. Make sure that you
are on the correct repository settings page when copying the token.
CODSPEED_TOKEN
and the value of your token.
Set the 
CODSPEED_TOKEN
variable as "Masked"
, but not "Protected"
, because
it must be available on all branches.
2. Create the benchmarks job
The next step is to create a new job to run the benchmarks for your repository. For example, you can add this job to your existing pipeline by adding a section in your.gitlab-ci.yml
file with the following content:
.gitlab-ci.yml
Make sure to run the job on
merge_request_event
. This is
required to have reports on merge requests correctly working.Learn more about baseline report selection.Sample configurations
.gitlab-ci.yml
CodSpeed only currently supports docker images that are based on Ubuntu or
Debian.
3. Check the results
Once the workflow is created, your merge requests will receive a performance report comment and will also receive some additional checks:
Merge Request Setup Comment with detected benchmarks

Merge Request Status Check with performance results
4. Next Steps
Now that everything is up and running (and hopefully green 🎉), you can start enhancing your workflow to get the most out of CodSpeed.Explore the Performance Metrics
Understand the performance metrics generated by CodSpeed
Enforce Performance Checks
Make sure you or team members never merge unexpected performance regressions
Dive in Trace Generation
Get detailed performance traces for your benchmarks
Shard the execution of your benchmarks
Run your benchmarks in parallel to speed up your CI
Advanced
Running benchmarks in parallel CI jobs
With GitlabCI, you can split your benchmarks across multiple jobs. For example withpytest
:
.gitlab-ci.yml
CodSpeed will only be able to aggregate results from your benchmarks if you
split them within a single CI workflow.