-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
215 lines (197 loc) · 5.94 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
# === Templates === #
# These are commonized definitions used across the stage definitions.
# Scroll down to the `CI Stages` section for the stage definitions.
.print_tool_versions_linux: &print_tool_versions_linux |
# Print tool versions
printf "Shell:\n"
$0 --version
printf "\n"
printf "Cargo:\n"
cargo --version -v
printf "\n"
printf "Rustc:\n"
rustc --version -v
printf "\n"
.install_update_cargo_subcommands: &install_update_cargo_subcommands >-
cargo install-update -i cargo-update
# === CI Stages === #
# Unfortunately we are not able to split `build` and `test` phases -- when we do, the `test` Gitlab
# CI runner is slightly different to the `build` runner, so the artifacts compiled in the `build`
# phase aren't used, and Rust attempts to recompile them in the test phase.
stages:
- build_and_test
- publish
variables:
# If we do not override `CARGO_HOME`, we must ensure that ALL projects that use the Gitlab runners
# do not request different versions of tooling, otherwise we run into concurrency issues.
# Also, we are not able to set it at the this level since we have a Windows runner which does not
# use the `$VAR` syntax, but `%VAR%`.
#
# Furthermore, there is an open bug in Gitlab that Windows is unable to use CI environment
# variables in .gitlab-ci.yml:
#
# See <https://gitlab.com/gitlab-org/gitlab-ce/issues/43337>
# ---
# CARGO_HOME: $CI_PROJECT_DIR/cargo
RUST_BACKTRACE: '1'
AMETHYST_LOG_LEVEL_FILTER: WARN
nightly:conformance:
stage: build_and_test # piggy backing so that it runs in parallel
tags:
- kcov
- linux
- rust
- nightly
variables:
RUSTUP_TOOLCHAIN: nightly-x86_64-unknown-linux-gnu
# Uncomment the next line if clippy is not compatible with the latest nightly.
# CLIPPY_ENABLED: 'false'
before_script:
- *print_tool_versions_linux
- scripts/install_packages_linux.sh
- scripts/install_cargo_update.sh
- *install_update_cargo_subcommands
# Security audit and license checks
- cargo install-update -i cargo-make cargo-audit cargo-license
script:
# Code quality, security vulnerability checks, license compatibility
- cargo make --no-workspace conformance
.linux_job_common: &linux_job_common
stage: build_and_test
tags:
- kcov
- linux
- rust
- stable
- xvfb
variables:
CARGO_MAKE_RUN_CODECOV: 'true'
# TODO: Revert to stable when Rust 1.41 is released.
# `InputReactions` was implemented relying on <https://github.com/rust-lang/rust/pull/65879>
RUSTUP_TOOLCHAIN: nightly-x86_64-unknown-linux-gnu
DISPLAY: ':0'
before_script:
- *print_tool_versions_linux
- scripts/install_packages_linux.sh
- scripts/install_cargo_update.sh
- *install_update_cargo_subcommands
- cargo install-update -i cargo-make hull
# Disabled until CI becomes stable, perhaps without using Vulkan.
.linux:debug:
<<: *linux_job_common
script:
- time cargo build --all-targets -j 4
- time cargo test -j 4 --no-run
- time cargo test -- --nocapture
after_script:
- 'export DISPLAY=:0'
- scripts/workspace_coverage.sh
- grep -F merged_files ./target/coverage/merged/index.js | grep -o '"covered":"[0-9]\+\.[0-9]\+"'
- bash <(curl -s https://codecov.io/bash) -s ./target/coverage/merged
coverage: '/"covered":"\d+\.\d+"/'
linux:release:
<<: *linux_job_common
script:
- time cargo build --all-targets -j 4 --release
- time cargo test -j 4 --no-run --release
- time cargo test --release -- --nocapture
- ./scripts/publish_prepare_app.sh
artifacts:
name: linux-x86_64
when: on_success
paths:
- target/publish
expire_in: 1 week
.windows_job_common: &windows_job_common
stage: build_and_test
tags:
- windows
- rust
- stable
variables:
# TODO: Revert to stable when Rust 1.41 is released.
# `InputReactions` was implemented relying on <https://github.com/rust-lang/rust/pull/65879>
RUSTUP_TOOLCHAIN: nightly-x86_64-pc-windows-msvc
before_script:
- cargo --version -v
- rustc --version -v
- cargo install-update -i hull
.windows:debug:
<<: *windows_job_common
script:
- cargo build --all-targets
- cargo test --no-run
- cargo test -- --nocapture
windows:release:
<<: *windows_job_common
script:
- cargo build --all-targets --release
- cargo test --no-run --release
- cargo test --release -- --nocapture
- .\scripts\publish_prepare_app.bat
artifacts:
name: windows-x86_64
when: on_success
paths:
- target/publish
expire_in: 1 week
linux:publish:
stage: publish
tags:
- linux
- rust
- stable
dependencies: ["linux:release"]
variables:
ITCH_IO_USER: azriel91
CHANNEL: linux-x86_64
CHANNEL_SERVER: linux-x86_64-server
script:
# Publish `will`
- app=will
- metadata="$(cargo metadata --format-version 1 --no-deps --manifest-path app/${app}/Cargo.toml)"
- version="$(echo "${metadata}" | jq -s ".[0].packages[] | select(.name == \"${app}\") | .version")"
- >
butler push \
"target/publish/app/${app}" \
"${ITCH_IO_USER}/${app}:${CHANNEL}" \
--userversion "${version}" \
--if-changed
# Publish `session_server`
- app_server=session_server
- >
butler push \
"target/publish/app/${app_server}" \
"${ITCH_IO_USER}/${app}:${CHANNEL_SERVER}" \
--userversion "${version}" \
--if-changed
artifacts:
name: linux-x86_64
when: on_success
paths:
- target/publish
expire_in: 1 week
only:
- tags
windows:publish:
stage: publish
tags:
- windows
- rust
- stable
dependencies: ["windows:release"]
variables:
ITCH_IO_USER: azriel91
CHANNEL: windows-x86_64
CHANNEL_SERVER: windows-x86_64-server
script:
# Publish `will` and `session_server`
- .\scripts\publish_butler_push.bat
artifacts:
name: windows-x86_64
when: on_success
paths:
- target/publish
expire_in: 1 week
only:
- tags