From 8f9b64f0756ba5706b8737f004fe5703761fc309 Mon Sep 17 00:00:00 2001 From: Chris Purta Date: Wed, 25 Jul 2018 13:49:19 -0700 Subject: [PATCH 1/5] Add update docs script to CI Added a script to CI that will use the jsonrpc tool to update rpc documentation then commit and push those to the wiki repo. --- .gitlab-ci.yml | 10 +++++++++ scripts/gitlab-rpc-docs.sh | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 scripts/gitlab-rpc-docs.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d73d494b2..36d76bfde 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -220,6 +220,16 @@ test-rust-nightly: - rust - rust-nightly allow_failure: true +json-rpc-docs: + stage: docs + only: + - tags + - master + image: parity/rust:gitlab-ci + script: + - scripts/gitlab-rpc-docs.sh + tags: + - docs push-release: stage: push-release only: diff --git a/scripts/gitlab-rpc-docs.sh b/scripts/gitlab-rpc-docs.sh new file mode 100755 index 000000000..ff5962a2b --- /dev/null +++ b/scripts/gitlab-rpc-docs.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +clone_repos() { + git clone https://github.com/parity-js/jsonrpc.git jsonrpc + git clone https://github.com/paritytech/wiki.git wiki +} + +build_docs() { + cp parity-ethereum jsonrpc/.parity + npm install + npm run build:markdown +} + +update_wiki_docs() { + for file in $(ls jsonrpc/docs); do + module_name=${file:0:-3} + mv jsonrpc/docs/$file wiki/JSONRPC-$module_name-module.md + done +} + +setup_git() { + git config user.email "runner@parity.com" + git config user.name "Parity Runner" +} + +commit_files() { + git checkout -b rpcdoc-update-${CI_COMMIT_REF_NAME} + git commit . + git commit -m "Update docs to ${CI_COMMIT_REF_NAME}" + git tag -a "${CI_COMMIT_REF_NAME}" +} + +upload_files() { + git push --tags +} + +setup_git +clone_repos +cd jsonrpc +build_docs +cd .. +update_wiki_docs +cd wiki +commit_files +upload_files From a1620871281cafa5bfe81b9de702e43ec1c26cbc Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Thu, 26 Jul 2018 00:10:57 +0300 Subject: [PATCH 2/5] fix gitlab ci lint --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36d76bfde..8564710ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ stages: - test - push-release - build + - docs variables: RUST_BACKTRACE: "1" RUSTFLAGS: "" From b9704254250cc913fd667cee20d92dbee2f44257 Mon Sep 17 00:00:00 2001 From: Christopher Purta Date: Thu, 26 Jul 2018 13:42:42 -0700 Subject: [PATCH 3/5] Only apply jsonrpc docs update on tags --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8564710ce..ac3e44892 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -225,7 +225,6 @@ json-rpc-docs: stage: docs only: - tags - - master image: parity/rust:gitlab-ci script: - scripts/gitlab-rpc-docs.sh From 10c4e0cae7d2705bfe63a37663a8938f0e3659f8 Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Fri, 27 Jul 2018 16:42:25 +0300 Subject: [PATCH 4/5] Update gitlab-rpc-docs.sh --- scripts/gitlab-rpc-docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gitlab-rpc-docs.sh b/scripts/gitlab-rpc-docs.sh index ff5962a2b..2887401f2 100755 --- a/scripts/gitlab-rpc-docs.sh +++ b/scripts/gitlab-rpc-docs.sh @@ -19,8 +19,8 @@ update_wiki_docs() { } setup_git() { - git config user.email "runner@parity.com" - git config user.name "Parity Runner" + git config user.email "devops@parity.com" + git config user.name "Devops Parity" } commit_files() { From 4c5952dc995c53e686752a9eeb0392c9cf7e1eca Mon Sep 17 00:00:00 2001 From: Christopher Purta Date: Tue, 31 Jul 2018 08:10:05 -0700 Subject: [PATCH 5/5] Copy correct parity repo to jsonrpc folder Copy correct parity repo to jsonrpc folder before attempting to build docs since the CI runner clones the repo as parity and not parity-ethereum. --- scripts/gitlab-rpc-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gitlab-rpc-docs.sh b/scripts/gitlab-rpc-docs.sh index 2887401f2..08e7b29d5 100755 --- a/scripts/gitlab-rpc-docs.sh +++ b/scripts/gitlab-rpc-docs.sh @@ -6,7 +6,6 @@ clone_repos() { } build_docs() { - cp parity-ethereum jsonrpc/.parity npm install npm run build:markdown } @@ -36,6 +35,7 @@ upload_files() { setup_git clone_repos +cp parity jsonrpc/.parity cd jsonrpc build_docs cd ..