diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-01-18 18:14:03 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-13 12:38:16 +0200 |
commit | 5b31c8bbf2dd0e0971fc22a8c21a6578a0c47fbf (patch) | |
tree | a7ff2a595d2e8e0e91c5a172664799ae756120e8 | |
parent | 18ecfd9e42a0b6c4f7a9fb713bbc53a9f5302b7c (diff) |
bench, ci: Add benchmarking CI job.
- Compare the current commit's performance to that of the previous
latest commit on the branch (CI_COMMIT_BEFORE_SHA).
- Use `critcmp` for benchmark output.
- Passes benchmark result as artifact.
- Run only for tags, web, scheduled pipelines, or the "bench" keyword.
-rw-r--r-- | .gitlab-ci.yml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1521be6..b77575ec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -92,6 +92,34 @@ bullseye:arm64: RUSTFLAGS: -D warnings -A unused-parens after_script: [] +benchmarks: + stage: test + image: registry.gitlab.com/sequoia-pgp/build-docker-image/bullseye:latest + needs: ["rust-stable"] + only: + refs: + - /bench/i # refs containing 'bench' keyword + - tags + - web + - scheduled + before_script: + - cargo install critcmp + script: + - cargo bench -- --color always --save-baseline $CI_COMMIT_SHA + after_script: + - MAIN_SHA=$(git merge-base $CI_COMMIT_SHA origin/main) + - echo CI_COMMIT_SHA=$CI_COMMIT_SHA > benchmark.txt + - echo CI_COMMIT_BEFORE_SHA=$CI_COMMIT_BEFORE_SHA >> benchmark.txt + - echo MAIN_SHA=$MAIN_SHA >> benchmark.txt + - $CARGO_HOME/bin/critcmp --baselines + - $CARGO_HOME/bin/critcmp $CI_COMMIT_SHA $CI_COMMIT_BEFORE_SHA $MAIN_SHA | tee -a benchmark.txt + artifacts: + expose_as: 'benchmark results' + paths: ['benchmark.txt'] + variables: + CARGO_TARGET_DIR: $CI_PROJECT_DIR/../target.benchmarks + RUSTFLAGS: -D warnings -A unused-parens + all_commits: # Test each commit up to main, to facilitate bisecting. stage: test |