From 0e68695700a64cdd70ef076cc6088db103809548 Mon Sep 17 00:00:00 2001 From: Denis Pisarev Date: Wed, 11 Aug 2021 19:41:08 +0200 Subject: [PATCH] CI: rustdoc (#3613) * CI: build rustdocs * CI: publish rustdocs * CI: naming * CI: debug * CI: MVP * CI: copypasta * CI: start page * CI: better start page * Revert "CI: debug" This reverts commit 497051f46a0c6554b2f5978af94def74a122136a. --- polkadot/.gitlab-ci.yml | 67 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml index bb79677c74..713ee8b5d1 100644 --- a/polkadot/.gitlab-ci.yml +++ b/polkadot/.gitlab-ci.yml @@ -41,9 +41,15 @@ default: - ./artifacts/ .kubernetes-env: &kubernetes-env + retry: + max: 2 + when: + - runner_system_failure + - unknown_failure + - api_failure + interruptible: true tags: - kubernetes-parity-build - interruptible: true .docker-env: &docker-env retry: @@ -232,6 +238,28 @@ generate-impl-guide: script: - mdbook build roadmap/implementers-guide +build-rustdoc: + stage: build + <<: *docker-env + <<: *rules-test + variables: + SKIP_WASM_BUILD: 1 + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}-doc" + when: on_success + expire_in: 7 days + paths: + - ./crate-docs/ + script: + # FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features` + - time cargo doc --no-deps --workspace --verbose + - rm -f ./target/doc/.lock + - mv ./target/doc ./crate-docs + # FIXME: remove me after CI image gets nonroot + - chown -R nonroot:nonroot ./crate-docs + - echo "" > ./crate-docs/index.html + - sccache -s + .build-push-image: &build-push-image <<: *kubernetes-env image: quay.io/buildah/stable @@ -393,6 +421,43 @@ publish-s3-release: &publish-s3 - aws s3 ls s3://${AWS_BUCKET}/${PREFIX}/${EXTRATAG}/ --recursive --human-readable --summarize +publish-rustdoc: + stage: publish + <<: *kubernetes-env + image: paritytech/tools:latest + variables: + GIT_DEPTH: 100 + rules: + - if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME == "master" + - if: $CI_COMMIT_REF_NAME == "master" + script: + - rm -rf /tmp/* + # Set git config + - rm -rf .git/config + - git config user.email "devops-team@parity.io" + - git config user.name "${GITHUB_USER}" + - git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/polkadot.git" + - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" + - git fetch origin gh-pages + # Save README and docs + - cp -r ./crate-docs/ /tmp/doc/ + - cp README.md /tmp/doc/ + - git checkout gh-pages + # Remove everything and restore generated docs and README + - rm -rf ./* + - mv /tmp/doc/* . + # Upload files + - git add --all --force + # `git commit` has an exit code of > 0 if there is nothing to commit. + # This causes GitLab to exit immediately and marks this job failed. + # We don't want to mark the entire job failed if there's nothing to + # publish though, hence the `|| true`. + - git commit -m "Updated docs for ${CI_COMMIT_REF_NAME}" || + echo "___Nothing to commit___" + - git push origin gh-pages --force + after_script: + - rm -rf .git/ ./* + #### stage: deploy deploy-polkasync-kusama: