ci: move help docs check script to its own file (#6140)

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2024-03-28 10:01:15 +01:00 committed by GitHub
parent 3ceb26ba23
commit 0fa363e022
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 13 deletions

19
ci/Jenkinsfile vendored
View File

@ -68,22 +68,15 @@ pipeline {
stage('Build') {
steps { timeout(50) {
sh 'make LOG_LEVEL=TRACE'
/* Check documentation reflects `nimbus_beacon_node --help`. */
sh '''#!/usr/bin/env bash
if ! diff -u \\
<(sed -n '/Usage/,/^...$/ { /^...$/d; p; }' \\
docs/the_nimbus_book/src/options.md) \\
<(COLUMNS=200 build/nimbus_beacon_node --help | \\
sed -n '/Usage/,/Available sub-commands/ { /Available sub-commands/d; p; }' | \\
sed 's/\\x1B\\[[0-9;]*[mG]//g' | \\
sed 's/[[:space:]]*$//'); then \\
echo "Please update 'docs/the_nimbus_book/src/options.md' to match 'COLUMNS=200 nimbus_beacon_node --help'"; \\
false; \\
fi
'''
} }
}
stage('Check Docs') {
steps {
sh './scripts/check_docs_help_msg.sh'
}
}
stage('Tests') {
parallel {
stage('General') {

22
scripts/check_docs_help_msg.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Copyright (c) 2023-2024 Status Research & Development GmbH.
# Licensed under either of:
# - Apache License, version 2.0
# - MIT license
# at your option. This file may not be copied, modified, or distributed
# except according to those terms.
set -euo pipefail
DOC_FILE='docs/the_nimbus_book/src/options.md'
DOC_USAGE=$(sed -n '/Usage/,/^...$/ { /^...$/d; p; }' "${DOC_FILE}")
BIN_USAGE=$(
COLUMNS=200 build/nimbus_beacon_node --help | \
sed -n '/Usage/,/Available sub-commands/ { /Available sub-commands/d; p; }' | \
sed 's/\\x1B\\[[0-9;]*[mG]//g' | \
sed 's/[[:space:]]*$//'
)
if ! diff -u <(echo "${DOC_USAGE}") <(echo "${BIN_USAGE}"); then
echo "Please update '${DOC_FILE}' to match 'COLUMNS=200 nimbus_beacon_node --help'"
exit 1
fi