.gitlab-ci.yml 4.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
# The `mindeps` builds are not working due, at the root, `syntex` -> `ctest` ->
# `flate2` -> `reqwest`.

before_script:
    - apt-get update -yqq
    - export CARGO_HOME=.cargo-cache
    - rustc --version
    - cargo --version

.cargo_update: &cargo_update
    - cargo generate-lockfile $GENERATE_LOCKFILE_ARGS
    - cargo fetch --locked
13
14
    - mkdir .cargo
    - cargo vendor > .cargo/config
15

16
.cargo_clippy: &cargo_clippy
Ben Boeckel's avatar
Ben Boeckel committed
17
18
19
    # Only use it if it's available; no need to fail the build due to something
    # gone wrong here.
    - .gitlab/ci/sccache.sh && export RUSTC_WRAPPER=$PWD/.gitlab/sccache
20
    - rustup component add clippy
Ben Boeckel's avatar
Ben Boeckel committed
21
    - cargo clippy --frozen --tests --all --verbose -- -D warnings
Ben Boeckel's avatar
Ben Boeckel committed
22
    - ".gitlab/sccache --show-stats || :"
23

24
.cargo_build: &cargo_build
Ben Boeckel's avatar
Ben Boeckel committed
25
26
27
    # Only use it if it's available; no need to fail the build due to something
    # gone wrong here.
    - .gitlab/ci/sccache.sh && export RUSTC_WRAPPER=$PWD/.gitlab/sccache
Ben Boeckel's avatar
Ben Boeckel committed
28
    - cargo build --frozen --all --verbose
29
    - cargo test --frozen --all --no-run --verbose
Ben Boeckel's avatar
Ben Boeckel committed
30
    - ".gitlab/sccache --show-stats || :"
31
32
33
34
35

.cargo_test: &cargo_test
    - cargo test --frozen --all --verbose

.rust_minimum: &rust_minimum
Ben Boeckel's avatar
Ben Boeckel committed
36
    image: "rust:1.36.0"
37
38
39

    variables:
        CARGO_UPDATE_POLICY: newest
Ben Boeckel's avatar
Ben Boeckel committed
40
        SCCACHE_REDIS: redis://minmus:6379
41
42
43
44
45
46

.rust_stable: &rust_stable
    image: "rust:latest"

    variables:
        CARGO_UPDATE_POLICY: newest
Ben Boeckel's avatar
Ben Boeckel committed
47
        SCCACHE_REDIS: redis://minmus:6379
48
49
50
51
52
53
54
55

.rust_nightly: &rust_nightly
    extends: .rust_stable

    image: "rustlang/rust:nightly"

.cargo_fetch_job: &cargo_fetch_job
    stage: prepare
56
57
58
59
60
61
    tags:
        - build
        - docker
        - ghostflow
        - linux

62
63
64
65
    script: *cargo_update
    artifacts:
        expire_in: 60m
        paths:
66
67
            - vendor
            - .cargo
68
69
70
71
72
73
74
            - Cargo.lock
    cache:
        key: cargo-cache-$CARGO_UPDATE_POLICY
        paths:
            - .cargo-cache
    interruptible: true

75
76
.cargo_clippy_job: &cargo_clippy_job
    stage: build
77
78
79
80
81
    tags:
        - build
        - docker
        - ghostflow
        - linux
82
83
84
    script: *cargo_clippy
    interruptible: true

85
86
.cargo_build_job: &cargo_build_job
    stage: build
87
88
89
90
91
    tags:
        - build
        - docker
        - ghostflow
        - linux
92
93
94
95
    script: *cargo_build
    artifacts:
        expire_in: 60m
        paths:
96
97
            - vendor
            - .cargo
98
99
100
101
102
103
            - Cargo.lock
            - target
    interruptible: true

.cargo_test_job: &cargo_test_job
    stage: test
104
105
106
107
108
    tags:
        - build
        - docker
        - ghostflow
        - linux
109
110
111
112
113
114
115
116
117
118
119
120
121
    script: *cargo_test
    interruptible: true

stages:
    - prepare
    - build
    - test

prepare:cargo-cache-newest:
    <<:
        - *cargo_fetch_job
        - *rust_stable

122
123
124
125
126
127
128
129
# prepare:cargo-cache-mindeps:
#     <<:
#         - *cargo_fetch_job
#         - *rust_nightly
#     variables:
#         GENERATE_LOCKFILE_ARGS: "-Z minimal-versions"
#         CARGO_UPDATE_POLICY: mindeps

130
131
132
133
134
135
136
137
.cargo_cache_newest: &cargo_cache_newest
    dependencies:
        - prepare:cargo-cache-newest
    needs:
        - prepare:cargo-cache-newest

build:cargo-clippy:
    <<:
138
        - *cargo_clippy_job
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
        - *rust_stable
        - *cargo_cache_newest

build:cargo-minimum:
    <<:
        - *cargo_build_job
        - *rust_minimum
        - *cargo_cache_newest

test:cargo-minimum:
    <<:
        - *cargo_test_job
        - *rust_minimum
    dependencies:
        - build:cargo-minimum
    needs:
        - build:cargo-minimum

build:cargo-stable:
    <<:
        - *cargo_build_job
        - *rust_stable
        - *cargo_cache_newest

test:cargo-stable:
    <<:
        - *cargo_test_job
        - *rust_stable
    dependencies:
        - build:cargo-stable
    needs:
        - build:cargo-stable

build:cargo-nightly:
    <<:
        - *cargo_build_job
        - *rust_nightly
        - *cargo_cache_newest

test:cargo-nightly:
    <<:
        - *cargo_test_job
        - *rust_nightly
    dependencies:
        - build:cargo-nightly
    needs:
        - build:cargo-nightly
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

# build:cargo-mindeps:
#     <<:
#         - *cargo_build_job
#         - *rust_minimum
#     dependencies:
#         - prepare:cargo-cache-mindeps
#     needs:
#         - prepare:cargo-cache-mindeps

# test:cargo-mindeps:
#     <<:
#         - *cargo_test_job
#         - *rust_minimum
#     dependencies:
#         - build:cargo-mindeps
#     needs:
#         - build:cargo-mindeps