1. After configuring the Runner, add a new job to `.gitlab-ci.yml` that generates
the expected report.
1. Define the `performance` job according to your version of GitLab:
Once you set up the Runner, add a new job to `.gitlab-ci.yml` that generates the
- For GitLab 12.4 and later - [include](../../../ci/yaml/README.md#includetemplate) the
expected report.
[`Browser-Performance.gitlab-ci.yml` template](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Verify/Browser-Performance.gitlab-ci.yml) provided as a part of your GitLab installation.
- For GitLab versions earlier than 12.4 - Copy and use the job as defined in the
For GitLab versions earlier than 12.4, you can copy and use the job as defined
in that template.
CAUTION: **Caution:**
1. Add the following to your `.gitlab-ci.yml` file:
The job definition provided by the template does not support Kubernetes yet. For a complete example of a more complex setup
that works in Kubernetes, see [here](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml).
Add the following to your `.gitlab-ci.yml` file:
```yaml
include:
template:Verify/Browser-Performance.gitlab-ci.yml
```yaml
performance:
include:
variables:
template:Verify/Browser-Performance.gitlab-ci.yml
URL:https://example.com
```
performance:
CAUTION: **Caution:**
variables:
The job definition provided by the template is supported in GitLab 11.5 and later versions.
URL:https://example.com
It also requires GitLab Runner 11.5 or later. For earlier versions, use the
The above example will create a `performance` job in your CI/CD pipeline and will run
The above example creates a `performance` job in your CI/CD pipeline and runs
sitespeed.io against the webpage you defined in `URL` to gather key metrics.
sitespeed.io against the webpage you defined in `URL` to gather key metrics.
The [GitLab plugin for sitespeed.io](https://gitlab.com/gitlab-org/gl-performance)
The [GitLab plugin for sitespeed.io](https://gitlab.com/gitlab-org/gl-performance)
is downloaded in order to save the report as a [Performance report artifact](../../../ci/pipelines/job_artifacts.md#artifactsreportsperformance-premium)
is downloaded to save the report as a [Performance report artifact](../../../ci/pipelines/job_artifacts.md#artifactsreportsperformance-premium)
that you can later download and analyze. Due to implementation limitations we always
that you can later download and analyze. Due to implementation limitations, we always
take the latest Performance artifact available.
take the latest Performance artifact available.
The full HTML sitespeed.io report will also be saved as an artifact, and if you have
The full HTML sitespeed.io report is saved as an artifact, and if
[GitLab Pages](../pages/index.md) enabled, it can be viewed directly in your browser.
[GitLab Pages](../pages/index.md)is enabled, it can be viewed directly in your browser.
It is also possible to customize options by setting the `SITESPEED_OPTIONS` variable.
You can also customize options by setting the `SITESPEED_OPTIONS` variable.
For example, this is how to override the number of runs sitespeed.io
For example, you can override the number of runs sitespeed.io
will make on the given URL:
makes on the given URL:
```yaml
```yaml
include:
include:
...
@@ -122,7 +116,8 @@ performance:
...
@@ -122,7 +116,8 @@ performance:
```
```
For further customization options for sitespeed.io, including the ability to provide a
For further customization options for sitespeed.io, including the ability to provide a
list of URLs to test, please see the [Sitespeed.io Configuration](https://www.sitespeed.io/documentation/sitespeed.io/configuration/)