2021-09-30 23:02:18 +05:30
|
|
|
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
|
|
|
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
|
|
|
# This specific template is located at:
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Verify/Browser-Performance.latest.gitlab-ci.yml
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
# Read more about the feature here: https://docs.gitlab.com/ee/ci/testing/browser_performance_testing.html
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
- performance
|
|
|
|
|
|
|
|
browser_performance:
|
|
|
|
stage: performance
|
|
|
|
image: docker:git
|
|
|
|
variables:
|
|
|
|
URL: ''
|
|
|
|
SITESPEED_IMAGE: sitespeedio/sitespeed.io
|
2023-03-04 22:38:38 +05:30
|
|
|
SITESPEED_VERSION: latest
|
2021-06-08 01:23:25 +05:30
|
|
|
SITESPEED_OPTIONS: ''
|
|
|
|
services:
|
2023-03-04 22:38:38 +05:30
|
|
|
- docker:dind
|
2021-06-08 01:23:25 +05:30
|
|
|
script:
|
|
|
|
- mkdir gitlab-exporter
|
|
|
|
# Busybox wget does not support proxied HTTPS, get the real thing.
|
|
|
|
# See https://gitlab.com/gitlab-org/gitlab/-/issues/287611.
|
2022-05-07 20:08:51 +05:30
|
|
|
- (env | grep -i _proxy= >/dev/null 2>&1) && apk --no-cache add wget
|
2021-06-08 01:23:25 +05:30
|
|
|
- wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/1.1.0/index.js
|
|
|
|
- mkdir sitespeed-results
|
|
|
|
- |
|
|
|
|
function propagate_env_vars() {
|
|
|
|
CURRENT_ENV=$(printenv)
|
|
|
|
|
|
|
|
for VAR_NAME; do
|
|
|
|
echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME "
|
|
|
|
done
|
|
|
|
}
|
|
|
|
- |
|
|
|
|
docker run \
|
|
|
|
$(propagate_env_vars \
|
|
|
|
auto_proxy \
|
|
|
|
https_proxy \
|
|
|
|
http_proxy \
|
|
|
|
no_proxy \
|
|
|
|
AUTO_PROXY \
|
|
|
|
HTTPS_PROXY \
|
|
|
|
HTTP_PROXY \
|
|
|
|
NO_PROXY \
|
|
|
|
) \
|
|
|
|
--shm-size=1g --rm -v "$(pwd)":/sitespeed.io $SITESPEED_IMAGE:$SITESPEED_VERSION --plugins.add ./gitlab-exporter --cpu --outputFolder sitespeed-results $URL $SITESPEED_OPTIONS
|
|
|
|
- mv sitespeed-results/data/performance.json browser-performance.json
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- sitespeed-results/
|
|
|
|
reports:
|
|
|
|
browser_performance: browser-performance.json
|