From 8f9b64f0756ba5706b8737f004fe5703761fc309 Mon Sep 17 00:00:00 2001 From: Chris Purta Date: Wed, 25 Jul 2018 13:49:19 -0700 Subject: [PATCH 1/7] 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 d73d494b24a..36d76bfde4c 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 00000000000..ff5962a2ba2 --- /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/7] fix gitlab ci lint --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36d76bfde4c..8564710cec7 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/7] 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 8564710cec7..ac3e44892fe 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/7] 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 ff5962a2ba2..2887401f25a 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/7] 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 2887401f25a..08e7b29d521 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 .. From a3be408d25cd68b851d4c96ccd4774f34e98f067 Mon Sep 17 00:00:00 2001 From: Chris Purta Date: Tue, 21 Aug 2018 14:09:01 -0700 Subject: [PATCH 6/7] Fix JSONRPC docs CI job Update remote config in wiki repo before pushing changes using a github token for authentication. Add message to wiki tag when pushing changes. Use project directory to correctly copy parity code base into the jsonrpc repo for doc generation. --- scripts/gitlab-rpc-docs.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/gitlab-rpc-docs.sh b/scripts/gitlab-rpc-docs.sh index 08e7b29d521..a30777851b8 100755 --- a/scripts/gitlab-rpc-docs.sh +++ b/scripts/gitlab-rpc-docs.sh @@ -17,29 +17,37 @@ update_wiki_docs() { done } +set_remote_wiki() { + git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/wiki.git" +} + setup_git() { - git config user.email "devops@parity.com" - git config user.name "Devops Parity" + git config --global user.email "devops@parity.com" + git config --global user.name "Devops Parity" } commit_files() { git checkout -b rpcdoc-update-${CI_COMMIT_REF_NAME} - git commit . + git add . git commit -m "Update docs to ${CI_COMMIT_REF_NAME}" - git tag -a "${CI_COMMIT_REF_NAME}" + git tag -a "${CI_COMMIT_REF_NAME}" -m "Updated to ${CI_COMMIT_REF_NAME}" } upload_files() { git push --tags } +PROJECT_DIR=$(pwd) + setup_git +cd .. clone_repos -cp parity jsonrpc/.parity +cp -r $PROJECT_DIR jsonrpc/.parity cd jsonrpc build_docs cd .. update_wiki_docs cd wiki +set_remote commit_files upload_files From 596e5d086e648413515b42546ca93674767b6852 Mon Sep 17 00:00:00 2001 From: Chris Purta Date: Tue, 21 Aug 2018 14:23:26 -0700 Subject: [PATCH 7/7] Fix set_remote_wiki function call in CI --- 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 a30777851b8..de03fc69f26 100755 --- a/scripts/gitlab-rpc-docs.sh +++ b/scripts/gitlab-rpc-docs.sh @@ -48,6 +48,6 @@ build_docs cd .. update_wiki_docs cd wiki -set_remote +set_remote_wiki commit_files upload_files