-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
183 lines (170 loc) · 4.71 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
183 lines (170 loc) · 4.71 KB
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
stages:
- containers
- check
- build
- test
- publish
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
.base_job_template:
interruptible: true
timeout: 30m
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
CACHE_FALLBACK_KEY: $CI_DEFAULT_BRANCH
.container_job_template:
extends: .base_job_template
image: docker:latest
stage: containers
services:
- docker:dind
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- .gitlab-ci.yml
- .gitlab-ci.d/images/$NAME.docker
before_script:
- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- until docker info; do sleep 1; done
script:
- export TAG="$CI_REGISTRY_IMAGE/imago-ci/$NAME:latest"
- export COMMON_TAG="$CI_REGISTRY/hreitz/imago/imago-ci/$NAME:latest"
- docker build --tag "$TAG" --cache-from "$TAG" --cache-from "$COMMON_TAG"
--build-arg BUILDKIT_INLINE_CACHE=1
-f ".gitlab-ci.d/images/$NAME.docker" "."
- docker push "$TAG"
after_script:
- docker logout
.rust_template:
extends: .base_job_template
image: $CI_REGISTRY/hreitz/imago/imago-ci/fedora-rustup:latest
cache:
- key: $CI_COMMIT_REF
paths: [ target/ ]
- key: cargo
paths: [ cargo/ ]
before_script:
- rustup --version && rustc --version && cargo --version
fedora-rustup-container:
extends: .container_job_template
variables:
NAME: fedora-rustup
check:clippy:
extends: .rust_template
stage: check
parallel:
matrix:
- TARGET: [ "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-pc-windows-gnu" ]
CARGO_OPTS: [ "--features=async,sync-wrappers,vm-memory", "--no-default-features --features=sync,vm-memory" ]
script:
- 'if test "$TARGET" = x86_64-pc-windows-gnu; then
CARGO_OPTS=$(echo "$CARGO_OPTS" | sed -e "s/,vm-memory//");
fi'
- 'cargo +stable clippy
--target $TARGET
--color always
--verbose
--all-targets
$CARGO_OPTS'
check:clippy-nightly:
extends: .rust_template
stage: check
parallel:
matrix:
- TARGET: [ "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-pc-windows-gnu" ]
CARGO_OPTS: [ "--features=async,sync-wrappers,vm-memory", "--no-default-features --features=sync,vm-memory" ]
allow_failure: true
script:
- 'if test "$TARGET" = x86_64-pc-windows-gnu; then
CARGO_OPTS=$(echo "$CARGO_OPTS" | sed -e "s/,vm-memory//");
fi'
- 'RUSTFLAGS=-Dunknown_lints cargo +nightly clippy
--target $TARGET
--color always
--verbose
--all-targets
$CARGO_OPTS'
check:fmt:
extends: .rust_template
stage: check
script:
- cargo +nightly fmt $CARGO_OPTS -- --check
allow_failure: true
build:
extends: .rust_template
stage: build
needs:
- job: "check:clippy"
timeout: 1h
parallel:
matrix:
- CARGO_OPTS: [ "", "--features=async,sync-wrappers,vm-memory", "--no-default-features --features=sync,vm-memory" ]
script:
- cargo +stable build --verbose --color always $CARGO_OPTS
build:docs:
extends: .rust_template
stage: build
needs:
- job: "check:clippy"
script:
- cargo +stable doc --color=always --verbose --no-deps --features=async,sync-wrappers,vm-memory --document-private-items
artifacts:
paths:
- target/doc
build:sync_docs:
extends: .rust_template
stage: build
needs:
- job: "check:clippy"
script:
- 'cargo +stable doc
--color=always
--verbose
--no-deps
--no-default-features
--features=sync,vm-memory
--document-private-items
--target-dir=target/sync'
artifacts:
paths:
- target/sync/doc
test:test:
extends: .rust_template
stage: test
parallel:
matrix:
- CARGO_OPTS: [ "", "--features=async,sync-wrappers,vm-memory", "--no-default-features --features=sync,vm-memory" ]
needs:
- job: build
script:
- 'cargo +stable test
--verbose
--color always
--workspace
--all-targets
--no-fail-fast
$CARGO_OPTS'
publish:docs:
stage: publish
image: alpine
dependencies:
- build:docs
- build:sync_docs
script:
- mkdir -p public
- mv target/doc public/doc
- mv target/sync/doc public/sync-doc
- echo '/imago /imago/doc/imago/index.html 302' > public/_redirects
- echo '/imago-sync /imago/sync-doc/imago/index.html 302' >> public/_redirects
- echo '/imago/sync /imago/sync-doc/imago/index.html 302' >> public/_redirects
- echo '/ /doc/imago/index.html 302' >> public/_redirects
- echo '/sync /sync-doc/imago/index.html 302' >> public/_redirects
artifacts:
paths:
- public
only:
- main
pages: true