mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Generate docs on commits / MRs, upload to Gitlab Pages and post link in comment
This commit is contained in:
parent
060088be29
commit
5bf2ef12eb
1 changed files with 51 additions and 0 deletions
|
@ -3,11 +3,19 @@
|
||||||
stages:
|
stages:
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
|
- docs
|
||||||
|
- bot
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
DOCS_BASEURL: "https://xmpp-rs.gitlab.io/xmpp-rs/"
|
||||||
FEATURES: ""
|
FEATURES: ""
|
||||||
RUST_BACKTRACE: "full"
|
RUST_BACKTRACE: "full"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
# Required to keep docs artifacts from old builds
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
|
||||||
.show-version:
|
.show-version:
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update; apt-get install -y --no-install-recommends pkg-config libssl-dev libicu-dev
|
- apt-get update; apt-get install -y --no-install-recommends pkg-config libssl-dev libicu-dev
|
||||||
|
@ -33,6 +41,30 @@ variables:
|
||||||
- cargo test --verbose --no-default-features
|
- cargo test --verbose --no-default-features
|
||||||
variables:
|
variables:
|
||||||
RUSTFLAGS: " -D warnings"
|
RUSTFLAGS: " -D warnings"
|
||||||
|
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"
|
||||||
|
|
||||||
rustfmt:
|
rustfmt:
|
||||||
stage: lint
|
stage: lint
|
||||||
|
@ -41,6 +73,9 @@ rustfmt:
|
||||||
- cargo fmt --check
|
- cargo fmt --check
|
||||||
extends:
|
extends:
|
||||||
- .stable
|
- .stable
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||||
|
- if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main'
|
||||||
|
|
||||||
stable-test:
|
stable-test:
|
||||||
extends:
|
extends:
|
||||||
|
@ -51,3 +86,19 @@ nightly-test:
|
||||||
extends:
|
extends:
|
||||||
- .test
|
- .test
|
||||||
- .nightly
|
- .nightly
|
||||||
|
|
||||||
|
pages:
|
||||||
|
extends:
|
||||||
|
- .docs
|
||||||
|
- .stable
|
||||||
|
|
||||||
|
bot-comment:
|
||||||
|
stage: bot
|
||||||
|
image: alpine:latest
|
||||||
|
script:
|
||||||
|
- apk add --no-cache glab
|
||||||
|
- glab mr --repo "$CI_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
|
||||||
|
|
Loading…
Reference in a new issue