-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
96 lines (84 loc) · 2.42 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
---
stages:
- lint
- test
- bot
variables:
DOCS_BASEURL: "https://docs.xmpp.rs"
FEATURES: ""
RUST_BACKTRACE: "full"
RUSTFLAGS: " -D warnings"
RUSTDOCFLAGS: " -D warnings"
.show-version:
before_script:
- apt-get update; apt-get install -y --no-install-recommends pkg-config libssl-dev
- rustc --version
- cargo --version
.stable:
image: rust:slim
extends:
- .show-version
.nightly:
image: rustlang/rust:nightly-slim
extends:
- .show-version
.test:
stage: test
script:
- cargo test --verbose --release -- --include-ignored
- cargo test --verbose --no-default-features
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
.docs:
stage: test
script:
- echo "Building docs to CI_DOC_TARGET=$CI_DOC_TARGET"
- RUSTDOCFLAGS="--cfg docsrs" RUSTFLAGS="--cfg xmpprs_doc_build" cargo +nightly doc --no-deps -Zrustdoc-map --all-features
- apt install -y rsync openssh-client
- mkdir -p $HOME/.ssh
- echo -e "Host docs\n\tHostname docs.xmpp.rs\n\tPort 1312\n\tUser xmpp-rs\n\tStrictHostKeyChecking no" > $HOME/.ssh/config
- echo "$SECRET_DOCS_SSH_PRIVATE" > $HOME/.ssh/id_ed25519
- chmod 400 $HOME/.ssh/id_ed25519
- rsync -av target/doc/ docs:$CI_DOC_TARGET
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
CI_DOC_TARGET: "$CI_MERGE_REQUEST_IID"
- if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
variables:
CI_DOC_TARGET: "main"
rustfmt:
stage: lint
script:
- rustup component add rustfmt
- cargo fmt --check
extends:
- .stable
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
stable-test:
extends:
- .test
- .stable
nightly-test:
# It's not often, but it happens nightly breaks, surprisingly.
allow_failure: true
extends:
- .test
- .nightly
docs:
extends:
- .docs
- .nightly
bot-comment:
stage: bot
image: alpine:latest
script:
- apk add --no-cache glab
- glab mr --repo "$CI_MERGE_REQUEST_PROJECT_PATH" comment $CI_MERGE_REQUEST_IID --unique --message "Thanks for your MR! You can preview the docs [here]($DOCS_BASEURL/$CI_MERGE_REQUEST_IID/)."
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
GITLAB_TOKEN: $MR_AUTOMATION_TOKEN