forked from wasmi-labs/wasmi
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
183 lines (164 loc) · 5.37 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# paritytech/wasmi
stages:
- benchmarks
- report
default:
retry:
max: 2
.docker-env:
image: "paritytech/ci-unified:bullseye-1.71.0"
interruptible: true
tags:
- benchmark
.kubernetes-env:
image: "paritytech/tools:latest"
tags:
- kubernetes-parity-build
.collect-artifacts:
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
paths:
- target/ci/
.common-before:
before_script:
# Show Versions
- cargo --version
- rustc --version
# Create dir for artifacts
- mkdir -p ./target/ci
.pr-refs:
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
.master-refs:
rules:
- if: $CI_COMMIT_REF_NAME == "master"
# benchmarks
criterion-benchmark:
stage: benchmarks
extends:
- .common-before
- .pr-refs
- .docker-env
- .collect-artifacts
script:
- git fetch
# Benchmark Branch: `master`
- git checkout master
- git pull
- git submodule update --init --recursive
- 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
extends:
- .common-before
- .pr-refs
- .docker-env
- .collect-artifacts
script:
# 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
- 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
- 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
criterion-benchmark-master:
stage: benchmarks
extends:
- .common-before
- .master-refs
- .docker-env
- .collect-artifacts
script:
- git submodule update --init --recursive
- cd ./crates/wasmi/
- cargo bench --bench benches -- --noplot --save-baseline master --output-format bencher | tee ../../target/ci/output-criterion.txt
wasmtime-benchmark-master:
stage: benchmarks
extends:
- .common-before
- .master-refs
- .docker-env
- .collect-artifacts
script:
# Install dependencies
- cargo install cargo-wasi
- curl https://wasmtime.dev/install.sh -sSf | bash
- source ~/.profile
# `wasmtime` Branch: `master`
- git submodule update --init --recursive
- 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 --output-format bencher | tee ../../target/ci/output-wasmtime.txt
# report
publish-report:
stage: report
extends:
- .pr-refs
- .kubernetes-env
needs:
- job: criterion-benchmark
artifacts: true
- job: wasmtime-benchmark
artifacts: true
script:
- bash ./scripts/ci/benchmarks-report.sh
publish-report-master:
stage: report
extends:
- .master-refs
- .kubernetes-env
needs:
- job: criterion-benchmark-master
artifacts: true
- job: wasmtime-benchmark-master
artifacts: true
script:
# Set git config
- rm -rf .git/config
- git config --global user.email "${GITHUB_EMAIL}"
- git config --global user.name "${GITHUB_USER}"
- git config remote.origin.url "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/paritytech/${CI_PROJECT_NAME}.git"
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
# push results to github
- git fetch origin gh-pages
- git checkout gh-pages
- mkdir -p benchmarks/criterion
- mkdir -p benchmarks/wasmtime
- cp target/ci/output-criterion.txt benchmarks/criterion/
- cp target/ci/output-wasmtime.txt benchmarks/wasmtime/
- git add benchmarks/
- git commit -m "[benchmarks] add benchmarks results for the latest master"
- git push origin gh-pages