forked from wasmi-labs/wasmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
116 lines (103 loc) · 3.49 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# paritytech/wasmi
stages:
- benchmarks
- report
default:
retry:
max: 2
.docker-env: &docker-env
image: "paritytech/ci-linux:staging"
interruptible: true
tags:
- benchmark
.kubernetes-env: &kubernetes-env
image: "paritytech/tools:latest"
tags:
- kubernetes-parity-build
# benchmarks
criterion-benchmark:
stage: benchmarks
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
<<: *docker-env
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
paths:
- target/ci/
script:
# Show Versions
- cargo --version
- rustc --version
- git fetch
# Benchmark Branch: `master`
- git checkout master
- git pull
- git submodule update --init --recursive
- mkdir -p ./target/ci
- pushd ./crates/wasmi/
- cargo bench --bench benches -- --noplot --save-baseline master | tee ../../target/ci/bench-master
- popd
- git submodule deinit --all -f
# Benchmark Branch: PR
- git checkout $CI_COMMIT_SHA
- git submodule update --init --recursive
- pushd ./crates/wasmi/
- cargo bench --bench benches -- --noplot --baseline master | tee ../../target/ci/bench-pr
- popd
# Save benchmark report
- mv ./target/criterion ./target/ci/criterion
wasmtime-benchmark:
stage: benchmarks
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
<<: *docker-env
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
paths:
- target/ci/
script:
# Show Versions
- cargo --version
- rustc --version
# Install dependencies
- cargo install cargo-wasi
- curl https://wasmtime.dev/install.sh -sSf | bash
- source ~/.profile
# `wasmtime` Branch: `master`
- git fetch
- git checkout master
- git pull
- git submodule update --init --recursive
- mkdir -p ./target/ci
- cargo wasi build --profile bench --bench benches --verbose
- cp `ls -t target/wasm32-wasi/release/deps/*wasi.wasm` target/ci/benches-master.wasm
- pushd ./crates/wasmi/
- wasmtime run --dir=. ../../target/ci/benches-master.wasm -- --bench --save-baseline master-wasm | tee ../../target/ci/wasmtime-master
- popd
- git submodule deinit --all -f
- rm -rf target/wasm32-wasi
# `wasmtime` Branch: `pr`
- git checkout $CI_COMMIT_SHA
- git submodule update --init --recursive
- mkdir -p ./target/ci
- cargo wasi build --profile bench --bench benches --verbose
- cp `ls -t target/wasm32-wasi/release/deps/*wasi.wasm` target/ci/benches-pr.wasm
- pushd ./crates/wasmi/
- wasmtime run --dir=. ../../target/ci/benches-pr.wasm -- --bench --baseline master-wasm | tee ../../target/ci/wasmtime-pr
- popd
- mv ./crates/wasmi/target/criterion ./target/ci/wasmtime-criterion
# report
publish-report:
stage: report
needs:
- criterion-benchmark
- wasmtime-benchmark
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
<<: *kubernetes-env
script:
- bash ./scripts/ci/benchmarks-report.sh