Skip to content

Commit

Permalink
Introduce temporary GitLab & GHA benchmarking jobs (paritytech#10311)
Browse files Browse the repository at this point in the history
* Introduce temporary bench job

* Add runner label

* CI: bench GHA

* CI: bench GHA

* CI: docs

* CI: more docs

* CI: run on master only

Co-authored-by: Denis P <denis.pisarev@parity.io>
  • Loading branch information
rcny and TriplEight authored Nov 24, 2021
1 parent 7406442 commit 3f657a5
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/bench_gh_gl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Please do not tamper with this job, it's a part of benchmarking experiment.
# However, you absolutely can copy it into another file and redo the last job in the pipeline.
# Just make sure you won't introduce long queues to the GHA runner, we have just one at the moment.

name: bench GHA against GitLab

on:
push:
branches: [ master ]

jobs:
bench_gh:
runs-on: self-hosted
env:
CARGO_INCREMENTAL: 0
RUSTUP_HOME: /usr/local/rustup
CARGO_HOME: /usr/local/cargo
CC: clang
CXX: clang

steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Install dependencies
# Template job, one can copy it to another pipeline.
run: |
apt-get update
apt-get install -y --no-install-recommends time clang
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
- name: Install Rust
# Template job, one can copy it to another pipeline.
# Referance code https://github.com/paritytech/scripts/blob/master/dockerfiles/base-ci-linux/Dockerfile
# Better keep Rust versions here in sync with the CI image, otherwise the results will conflict.
run: |
curl -L "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" -o rustup-init
chmod +x rustup-init
./rustup-init -y --no-modify-path --profile minimal --default-toolchain stable
rm rustup-init
# add rustup tp PATH so it's usable right away
echo "/usr/local/cargo/bin" >> $GITHUB_PATH
source /usr/local/cargo/env
chmod -R a+w ${RUSTUP_HOME} ${CARGO_HOME}
# install nightly toolchain
rustup toolchain install nightly-2021-11-08 --profile minimal --component rustfmt clippy
# link the pinned toolchain to nightly
ln -s /usr/local/rustup/toolchains/nightly-2021-11-08-x86_64-unknown-linux-gnu /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu
rustup target add wasm32-unknown-unknown
rustup target add wasm32-unknown-unknown --toolchain nightly
# show versions
rustup show
cargo --version
# remove clutter from the installations
rm -rf "${CARGO_HOME}/registry" "${CARGO_HOME}/git"
- name: Checkout sources
uses: actions/checkout@v2

- name: bench-GHA-test-full-crypto-feature
# GitHub env variables reference: https://docs.github.com/en/actions/learn-github-actions/environment-variables
# The important part of the experiment is the line with `curl`: it sends the job's timing to Prometheus.
run: |
START_TIME=`date '+%s'`
cd primitives/core/
time cargo +nightly build --verbose --no-default-features --features full_crypto
cd ../application-crypto
time cargo +nightly build --verbose --no-default-features --features full_crypto
END_TIME=`date '+%s'`
TOTAL_TIME=`expr $END_TIME - $START_TIME`
# please remove this line if you want to play with GHA runner.
curl -d "parity_github_job_time{project=\"$GITHUB_REPOSITORY\",job=\"$GITHUB_WORKFLOW\",runner=\"github\"} $TOTAL_TIME" -X POST http://vm-longterm.parity-build.parity.io/api/v1/import/prometheus
29 changes: 29 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,35 @@ test-full-crypto-feature:
- time cargo +nightly build --verbose --no-default-features --features full_crypto
- sccache -s


# Mostly same as the job above, additional instrumentation was added to push test run times
# to the time series database.
# This is temporary and will be eventually removed.
bench-test-full-crypto-feature:
stage: test
<<: *docker-env
<<: *build-refs
variables:
<<: *default-vars
RUSTFLAGS: "-Cdebug-assertions=y"
RUST_BACKTRACE: 1
before_script: [""]
script:
# disable sccache for the bench purposes
- unset RUSTC_WRAPPER
- START_TIME=`date '+%s'`
- cd primitives/core/
- time cargo +nightly build --verbose --no-default-features --features full_crypto
- cd ../application-crypto
- time cargo +nightly build --verbose --no-default-features --features full_crypto
- END_TIME=`date '+%s'`
- TOTAL_TIME=`expr $END_TIME - $START_TIME`
# send the job time measuring to the prometheus endpoint
- curl -d "parity_gitlab_job_time{project=\"$CI_PROJECT_PATH\",job=\"$CI_JOB_NAME\",runner=\"gitlab\"} $TOTAL_TIME" -X POST $VM_LONGTERM_URI/api/v1/import/prometheus
tags:
- linux-docker-compare


test-wasmer-sandbox:
stage: test
<<: *docker-env
Expand Down

0 comments on commit 3f657a5

Please sign in to comment.