2022-09-16 18:00:55 +00:00
---
2018-12-20 15:56:15 +00:00
stages :
2019-10-22 23:32:41 +00:00
- lint
2018-12-20 16:11:16 +00:00
- test
2024-01-22 16:01:37 +00:00
- docs
- bot
2018-12-20 15:56:15 +00:00
2018-12-29 23:49:57 +00:00
variables :
2024-01-22 16:01:37 +00:00
DOCS_BASEURL : "https://xmpp-rs.gitlab.io/xmpp-rs/"
2018-12-29 23:49:57 +00:00
FEATURES : ""
2019-09-13 01:33:08 +00:00
RUST_BACKTRACE : "full"
2018-12-29 23:49:57 +00:00
2024-01-22 16:01:37 +00:00
cache :
# Required to keep docs artifacts from old builds
paths :
- public
2021-12-27 00:22:53 +00:00
.show-version :
before_script :
2023-06-05 23:07:19 +00:00
- apt-get update; apt-get install -y --no-install-recommends pkg-config libssl-dev libicu-dev
2021-12-27 00:22:53 +00:00
- rustc --version
- cargo --version
2019-09-13 01:33:08 +00:00
.stable :
2023-06-01 15:21:56 +00:00
image : rust:slim
2021-12-27 00:22:53 +00:00
extends :
- .show-version
2018-12-20 15:56:15 +00:00
2019-09-13 01:33:08 +00:00
.nightly :
2023-06-01 15:21:56 +00:00
image : rustlang/rust:nightly-slim
2022-09-16 18:00:55 +00:00
# It's not often, but it happens nightly breaks, surprisingly.
allow_failure : true
2021-12-27 00:22:53 +00:00
extends :
- .show-version
2019-09-13 01:33:08 +00:00
.test :
2018-12-20 16:11:16 +00:00
stage : test
script :
2023-08-17 20:29:04 +00:00
- cargo test --verbose --release -- --include-ignored
- cargo test --verbose --no-default-features
2024-01-16 21:21:50 +00:00
variables :
RUSTFLAGS : " -D warnings"
2024-01-22 16:01:37 +00:00
rules :
- if : $CI_PIPELINE_SOURCE == 'merge_request_event'
- if : $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
.docs :
stage : docs
script :
- echo "Building docs to CI_DOC_TARGET=$CI_DOC_TARGET"
- cargo doc
- rm -rf "$CI_DOC_TARGET"
- mkdir -p "$(dirname "$CI_DOC_TARGET")"
- mv target/doc "$CI_DOC_TARGET"
- echo "<a href='jid'>jid</a><br><a href='minidom'>minidom</a><br><a href='sasl'>sasl</a><br><a href='tokio_xmpp'>tokio_xmpp</a><br><a href='xmpp'>xmpp</a><br><a href='xmpp_parsers'>xmpp_parsers</a>" > "$CI_DOC_TARGET"/index.html
artifacts :
name : "$CI_DOC_TARGET"
paths :
- public
rules :
- if : $CI_PIPELINE_SOURCE == 'merge_request_event'
variables :
CI_DOC_TARGET : "public/$CI_MERGE_REQUEST_IID"
- if : $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
variables :
CI_DOC_TARGET : "public/main"
2018-12-20 16:11:16 +00:00
2019-10-22 23:32:41 +00:00
rustfmt :
stage : lint
script :
2020-03-26 17:09:59 +00:00
- rustup component add rustfmt
2022-09-16 18:01:21 +00:00
- cargo fmt --check
2020-03-26 17:09:59 +00:00
extends :
- .stable
2024-01-22 16:01:37 +00:00
rules :
- if : $CI_PIPELINE_SOURCE == 'merge_request_event'
- if : $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
2019-10-22 23:32:41 +00:00
2020-04-05 01:41:19 +00:00
stable-test :
2019-09-13 01:33:08 +00:00
extends :
- .test
- .stable
2020-04-05 01:41:19 +00:00
nightly-test :
2019-09-13 01:33:08 +00:00
extends :
- .test
- .nightly
2024-01-22 16:01:37 +00:00
pages :
extends :
- .docs
- .stable
bot-comment :
stage : bot
image : alpine:latest
script :
- apk add --no-cache glab
2024-01-24 22:18:05 +00:00
- 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/)."
2024-01-22 16:01:37 +00:00
rules :
- if : $CI_PIPELINE_SOURCE == 'merge_request_event'
variables :
GITLAB_TOKEN : $MR_AUTOMATION_TOKEN