-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
120 lines (109 loc) · 2.86 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
# Test at a specific version in order to prevent accidentally requiring a new
# Rust version. Image tags are at: https://hub.docker.com/r/library/rust/tags/
image: "rust:latest"
# If we run the test before the docs, we can cache the build and not waste time
# building it again.
stages:
- analysis
- test
- docs
# Move a few of the "home" directories here so they are easier to cache.
variables:
GIT_SUBMODULE_STRATEGY: normal
CARGO_HOME: $CI_PROJECT_DIR/cargo
APT_CACHE_DIR: $CI_PROJECT_DIR/apt
# Since we default to compiling nng, we need to install some C tooling.
before_script:
- apt-get update -yqq
- apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -yqq --no-install-recommends build-essential cmake
# My preferred formatting *requires* the nightly version of Rustfmt. Since using the
# latest stable won't work and nightly doesn't always have the Rustfmt component, we
# will allow this one to fail.
format:
image: "rustlang/rust:nightly-slim"
stage: analysis
script:
- rustup component add rustfmt
- cargo fmt --version
- cargo fmt --package nng -- --check
allow_failure: true
only:
- tags
- master
- merge_requests
# We can't use the nightly image for Clippy since nightly sometimes doesn't have it.
# However, we don't *need* nightly so we'll fall back to stable and not allow it
# to fail.
clippy:
stage: analysis
script:
- rustup component add clippy
- cargo clippy --version
- cargo clippy --all-targets --all-features
only:
- tags
- master
- merge_requests
# Test the project against the minimum Rust version to make sure we don't raise it
minimum-rust-version:
image: "rust:1.36-slim-buster"
stage: test
script:
- rustc --version
- cargo --version
- cargo test --all --all-features --verbose
only:
- tags
- master
- merge_requests
# Check against the current stable for regressions
stable:
stage: test
script:
- rustc --version
- cargo --version
- cargo test --all --all-features --verbose
only:
- tags
- master
- merge_requests
# Also check against nightly for regressions
nightly:
image: "rustlang/rust:nightly-slim"
stage: test
script:
- rustc --version
- cargo --version
- cargo test --all --all-features --verbose
allow_failure: true
only:
- tags
- master
- merge_requests
# Make sure that the examples also build
examples:
stage: docs
script:
- cargo build --examples
only:
- tags
- master
- merge_requests
# Publish to the pages whenever master is updated
pages:
stage: docs
script:
- cargo doc --no-deps
- mv target/doc public
- echo '<meta http-equiv="refresh" content="0; url=nng">' > public/index.html
artifacts:
paths:
- public
only:
- master
# Store these before jobs to speed up the build
cache:
paths:
- apt/
- cargo/
- target/