96 lines
2.3 KiB
YAML
96 lines
2.3 KiB
YAML
---
|
|
|
|
stages:
|
|
- lint
|
|
- test
|
|
- bot
|
|
|
|
variables:
|
|
DOCS_BASEURL: "https://docs.xmpp.rs"
|
|
FEATURES: ""
|
|
RUST_BACKTRACE: "full"
|
|
|
|
.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
|
|
# It's not often, but it happens nightly breaks, surprisingly.
|
|
allow_failure: true
|
|
extends:
|
|
- .show-version
|
|
|
|
.test:
|
|
stage: test
|
|
script:
|
|
- cargo test --verbose --release -- --include-ignored
|
|
- cargo test --verbose --no-default-features
|
|
variables:
|
|
RUSTFLAGS: " -D warnings"
|
|
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"
|
|
- cargo +nightly doc --no-deps -Zrustdoc-map
|
|
- 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:
|
|
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
|