Skip to content

feat: generate config docs on ci #6227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/stacks-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ jobs:
input: ./docs/rpc/openapi.yaml
output: ./open-api-docs.html

## Generate and upload node configuration documentation
node-config-docsgen:
name: Node Configuration Documentation
uses: stacks-network/actions/node-config-docsgen@main

## Disabled
## - this test can take several hours to run
nettest:
Expand Down Expand Up @@ -138,6 +143,7 @@ jobs:
if: always()
needs:
- open-api-validation
- node-config-docsgen
- core-contracts-clarinet-test
steps:
- name: Check Tests Status
Expand Down
17 changes: 8 additions & 9 deletions contrib/tools/config-docs-generator/generate-config-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NC='\033[0m' # No Color
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$SCRIPT_DIR/../../../" && pwd)}"
CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$PROJECT_ROOT/target}"
OUTPUT_DIR="${OUTPUT_DIR:-$CARGO_TARGET_DIR/generated-docs}"
OUTPUT_FILE="${OUTPUT_FILE:-$CARGO_TARGET_DIR/generated-docs/node-parameters.md}"
TEMP_DIR="${TEMP_DIR:-$CARGO_TARGET_DIR/doc-generation}"

# Binary paths - allow override via environment
Expand Down Expand Up @@ -52,7 +52,7 @@ main() {
log_info "Starting config documentation generation..."

# Create necessary directories
mkdir -p "$OUTPUT_DIR"
mkdir -p "$(dirname "$OUTPUT_FILE")"
mkdir -p "$TEMP_DIR"

cd "$PROJECT_ROOT"
Expand Down Expand Up @@ -81,22 +81,21 @@ main() {

# Step 3: Generate Markdown
log_info "Generating Markdown documentation..."
MARKDOWN_OUTPUT="$OUTPUT_DIR/configuration-reference.md"

# Call the command
"$GENERATE_MARKDOWN_BIN" --input "$EXTRACTED_JSON" --output "$MARKDOWN_OUTPUT" --template "$TEMPLATE_PATH" --section-name-mappings "$SECTION_MAPPINGS_PATH"
"$GENERATE_MARKDOWN_BIN" --input "$EXTRACTED_JSON" --output "$OUTPUT_FILE" --template "$TEMPLATE_PATH" --section-name-mappings "$SECTION_MAPPINGS_PATH"

log_info "Documentation generation complete!"
log_info "Generated files:"
log_info " - Configuration reference: $MARKDOWN_OUTPUT"
log_info " - Configuration reference: $OUTPUT_FILE"
log_info " - Intermediate JSON: $EXTRACTED_JSON"

# Verify output
if [[ -f "$MARKDOWN_OUTPUT" ]]; then
WORD_COUNT=$(wc -w < "$MARKDOWN_OUTPUT")
if [[ -f "$OUTPUT_FILE" ]]; then
WORD_COUNT=$(wc -w < "$OUTPUT_FILE")
log_info "Generated Markdown contains $WORD_COUNT words"
else
log_error "Expected output file not found: $MARKDOWN_OUTPUT"
log_error "Expected output file not found: $OUTPUT_FILE"
exit 1
fi
}
Expand Down Expand Up @@ -125,7 +124,7 @@ DESCRIPTION:
Source file: stackslib/src/config/mod.rs

OUTPUT:
docs/generated/configuration-reference.md
docs/generated/node-parameters.md

EOF
}
Expand Down
Loading