-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
55 lines (51 loc) · 1.29 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
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/rust/tags/
image: "rust:latest"
.cache:
variables:
CARGO_HOME: "${CI_PROJECT_DIR}/cargo_cache"
before_script:
- mkdir -p cargo_cache
- echo $CARGO_HOME
cache:
when: 'on_success'
key:
files:
- Cargo.lock
paths:
# Rust cache
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
- cargo_cache/bin
- cargo_cache/registry/index
- cargo_cache/registry/cache
- cargo_cache/git/db
- target/
# Test and lint the project: do not build binaries
# that require rocksdb and other dependencies
test:cargo:
extends: '.cache'
only:
- merge_requests
cache:
key:
prefix: test
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo test --workspace --verbose
lint:rustfmt:
only:
- merge_requests
script:
- rustup component add rustfmt
- cargo fmt -- --check
lint:clippy:
extends: '.cache'
only:
- merge_requests
cache:
key:
prefix: clippy
script:
- rustup component add clippy
- cargo clippy --all-targets -- -D warnings