Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[ci] publish parachain-implementers-guide #5806

Merged
merged 18 commits into from
Jul 22, 2022
60 changes: 43 additions & 17 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ default:
paths:
- ./artifacts/

.collect-artifacts-short: &collect-artifacts-short
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
paths:
- ./artifacts/

.kubernetes-env: &kubernetes-env
retry:
max: 2
Expand Down Expand Up @@ -559,27 +567,29 @@ build-rustdoc:
script:
# FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features`
# FIXME: return to stable when https://github.com/rust-lang/rust/issues/96937 gets into stable
- time cargo +nightly doc --workspace --verbose
- time cargo +nightly doc --workspace --verbose --no-deps
- 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 "<meta http-equiv=refresh content=0;url=polkadot_service/index.html>" > ./crate-docs/index.html
- sccache -s

generate-impl-guide:
build-implementers-guide:
stage: stage3
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-transaction-versions
- job: test-deterministic-wasm
artifacts: false
<<: *test-refs
<<: *docker-env
image:
name: michaelfbryan/mdbook-docker-image:v0.4.4
entrypoint: [""]
<<: *collect-artifacts-short
script:
- cargo install mdbook mdbook-mermaid mdbook-linkcheck
- mdbook build ./roadmap/implementers-guide
- mkdir -p artifacts
- mv roadmap/implementers-guide/book artifacts/
# FIXME: remove me after CI image gets nonroot
- chown -R nonroot:nonroot artifacts/

check-try-runtime:
stage: stage3
Expand Down Expand Up @@ -858,7 +868,12 @@ publish-rustdoc:
needs:
- job: build-rustdoc
artifacts: true
- job: build-implementers-guide
artifacts: true
script:
# Save README and docs
- cp -r ./crate-docs/ /tmp/doc/
- cp -r ./artifacts/book/ /tmp/
# setup ssh
- eval $(ssh-agent)
- ssh-add - <<< ${GITHUB_SSH_PRIV_KEY}
Expand All @@ -870,13 +885,19 @@ publish-rustdoc:
- git config remote.origin.url "git@github.com:/paritytech/${CI_PROJECT_NAME}.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
- cp index.html /tmp
- cp README.md /tmp
- rm -rf ./*
- mv /tmp/doc/* .
# dir for rustdoc
- mkdir -p doc
# dir for implementors guide
- mkdir -p book
- mv /tmp/doc/* doc/
- mv /tmp/book/html/* book/
- mv /tmp/index.html .
- mv /tmp/README.md .
# Upload files
- git add --all --force
# `git commit` has an exit code of > 0 if there is nothing to commit.
Expand Down Expand Up @@ -919,13 +940,8 @@ short-benchmark-westend:
# This job cancels the whole pipeline if any of provided jobs fail.
# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
# to fail the pipeline as soon as possible to shorten the feedback loop.
cancel-pipeline:
.cancel-pipeline-template:
stage: .post
needs:
- job: test-linux-stable
artifacts: false
- job: check-try-runtime
artifacts: false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: on_failure
Expand All @@ -934,4 +950,14 @@ cancel-pipeline:
PIPELINE_ID: "${CI_PIPELINE_ID}"
trigger: "parity/infrastructure/ci_cd/pipeline-stopper"

cancel-pipeline-test-linux-stable:
extends: .cancel-pipeline-template
needs:
- job: test-linux-stable
artifacts: false

cancel-pipeline-check-try-runtime:
extends: .cancel-pipeline-template
needs:
- job: check-try-runtime
artifacts: false