-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
229 lines (212 loc) · 6.69 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
stages:
- check
- build
- test
- tests
- bench
- release
# Install additional packages, like a C compiler and cmake
#before_script:
#- apt-get update -yqq
#- apt-get install -yqq --no-install-recommends build-essential cmake
# Use cargo to check the source code formatting
cargo:check-format:
stage: check
image: rust:latest
before_script:
- rustup component add rustfmt-preview
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo fmt --all --verbose -- --check
# Use cargo to run clippy (Rust linter)
cargo:clippy:
stage: check
image: rust:latest
before_script:
- rustup component add clippy-preview
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo clippy
# Check that every ignored test has an accompanying comment
check-ignored-tests:
stage: check
image: alpine:latest
before_script:
- apk update && apk add --no-cache bash
script:
- ./check_ignored_tests_without_comment.sh
allow_failure: true
# Use cargo to test the project on stable toolchain
cargo:test:
stage: test
image: rust:latest
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends libpcap-dev
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo test --all --verbose
# Use cargo to test the project on stable toolchain on windows
cargo:test:windows:
stage: tests
tags:
- windows
- rust
script:
- rustup update
- rustc --version && cargo --version # Print version info for debugging
- cargo test --all --verbose
allow_failure: true
# Use cargo to test the project on nightly toolchain
cargo:test-nightly:
stage: test
image: rustlang/rust:nightly
variables:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends libpcap-dev python3-pip
- pip3 install junit-xml
- cargo install grcov
- cargo install cargo2junit
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo build
- (cargo test -- -Z unstable-options --format json | cargo2junit > results.xml) || true # ignore the return code so that we can show the complete output (including ignored tests)
- python3 ./tests/rtlola-interpreter-e2e-tests.py || true # count the e2e test for coverage but keep going
- grcov ./target/debug/ -s . -t html --llvm --branch --ignore-not-existing -o ./target/debug/coverage/
- cat ./target/debug/coverage/index.html
- cargo test --all --verbose
allow_failure: true
coverage: '/linesPercentage \w+">\d+\.\d+ /'
artifacts:
when: always
paths:
- target/debug/coverage/
reports:
junit: results.xml
# Run the tool by checking the number of triggers fired
integration_tests:
stage: test
image: rust:latest
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends libpcap-dev python3-pip
- pip3 install junit-xml
variables:
BUILD_MODE: "release"
script:
- python3 ./tests/rtlola-interpreter-e2e-tests.py
artifacts:
when: always
reports:
junit: e2e-results.xml
# Use cargo to run the benchmarks
cargo:bench:
stage: bench
tags:
- benchmarking
image: rustlang/rust:nightly
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends libpcap-dev
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo bench --quiet | grep -e 'bench:' | tee bench_results.txt # TODO: actually compare the results
- sed s/'test '// bench_results.txt | sed -e s/' ... bench:'// | sed -e s/,//g | sed -e "s|ns/iter.*$||" > metrics.txt
artifacts:
name: "bench_results"
paths:
- bench_results.txt
expire_in: 5 yrs
reports:
metrics: metrics.txt
allow_failure: true
# For the release build we do not use the Cargo.lock file, because we haven't investigated how it interacts with different platforms.
# Windows, Linux, and MacOS could resolve to different Cargo.lock files.
# However, we keep the Cargo.lock files as artifacts.
release-windows:
stage: release
only:
- tags
- web
- triggers
tags:
- windows
- rust
variables:
RUSTFLAGS: "-C target-feature=+crt-static"
before_script:
- cd evaluator
- rustup update
- rustc --version && cargo --version # Print version info for debugging
script:
- rustup run stable-msvc cargo build --release --target x86_64-pc-windows-msvc --features public
artifacts:
name: "rtlola-interpreter-windows-${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}"
paths:
- target/x86_64-pc-windows-msvc/release/rtlola-interpreter.exe
- Cargo.lock
#release-windows-gnu:
# stage: release
# only:
# - tags
# - web
# - triggers
# tags:
# - windows
# - rust
# before_script:
# - cd evaluator
# - rustup update
# - rustc --version && cargo --version # Print version info for debugging
# script:
# - rustup run stable-gnu cargo build --release --target x86_64-pc-windows-gnu --features public
# artifacts:
# name: "rtlola-interpreter-windows-gnu-${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}"
# paths:
# - target/x86_64-pc-windows-gnu/release/rtlola-interpreter.exe
# - Cargo.lock
release-linux:
stage: release
image: rust:latest
only:
- tags
- web
- triggers
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends musl-dev musl-tools clang
- cd evaluator
- rustup target add x86_64-unknown-linux-musl
- rustc --version && cargo --version # Print version info for debugging
script:
- cargo build --release --target x86_64-unknown-linux-musl --features public
artifacts:
name: "rtlola-interpreter-linux-${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}"
paths:
- target/x86_64-unknown-linux-musl/release/rtlola-interpreter
- Cargo.lock
#release-macos:
# stage: release
# only:
# - tags
# - web
# - triggers
# tags:
# - macos
# variables:
# MACOSX_DEPLOYMENT_TARGET: "10.7"
# before_script:
# - cd evaluator
# - rustup update
# - rustc --version && cargo --version # Print version info for debugging
# script:
# - rustup run stable-msvc cargo build --release --target x86_64-apple-darwin --features public
# artifacts:
# name: "rtlola-interpreter-macos-${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}"
# paths:
# - target/x86_64-apple-darwin/release/rtlola-interpreter
# - Cargo.lock