Skip to content

Commit 8f3ccbc

Browse files
authored
Merge pull request #6227 from Jiloc/feat/generate-config-docs-on-ci
feat: generate config docs on ci
2 parents 63f180e + 36a9e41 commit 8f3ccbc

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

.github/workflows/stacks-core-tests.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ jobs:
7171
validate: "true"
7272
redocly-version: "1.34"
7373

74+
## Generate and upload node configuration documentation
75+
node-config-docsgen:
76+
name: Node Configuration Documentation
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Generate Node Configuration Documentation
80+
id: node_config_docsgen
81+
uses: stacks-network/actions/stacks-core/node-config-docsgen@main
82+
7483
## Disabled
7584
## - this test can take several hours to run
7685
nettest:
@@ -141,6 +150,7 @@ jobs:
141150
if: always()
142151
needs:
143152
- open-api-validation
153+
- node-config-docsgen
144154
- core-contracts-clarinet-test
145155
steps:
146156
- name: Check Tests Status

contrib/tools/config-docs-generator/generate-config-docs.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ NC='\033[0m' # No Color
1212
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1313
PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$SCRIPT_DIR/../../../" && pwd)}"
1414
CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$PROJECT_ROOT/target}"
15-
OUTPUT_DIR="${OUTPUT_DIR:-$CARGO_TARGET_DIR/generated-docs}"
15+
OUTPUT_FILE="${OUTPUT_FILE:-$CARGO_TARGET_DIR/generated-docs/node-parameters.md}"
1616
TEMP_DIR="${TEMP_DIR:-$CARGO_TARGET_DIR/doc-generation}"
1717

1818
# Binary paths - allow override via environment
@@ -52,11 +52,17 @@ main() {
5252
log_info "Starting config documentation generation..."
5353

5454
# Create necessary directories
55-
mkdir -p "$OUTPUT_DIR"
55+
mkdir -p "$(dirname "$OUTPUT_FILE")"
5656
mkdir -p "$TEMP_DIR"
5757

5858
cd "$PROJECT_ROOT"
5959

60+
# Workaround for new nightly lint that breaks stacks-common build.
61+
# Allow callers to override or extend, but default to allowing the lint so documentation generation
62+
# stays green until codebase is updated.
63+
# TODO: Remove this once codebase will be updated to use the new lifetime syntax.
64+
export RUSTFLAGS="${RUSTFLAGS:-} -A mismatched-lifetime-syntaxes"
65+
6066
# Step 1: Build the documentation generation tools
6167
if [[ "$SKIP_BUILD" != "true" ]]; then
6268
log_info "Building documentation generation tools..."
@@ -81,22 +87,21 @@ main() {
8187

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

8691
# Call the command
87-
"$GENERATE_MARKDOWN_BIN" --input "$EXTRACTED_JSON" --output "$MARKDOWN_OUTPUT" --template "$TEMPLATE_PATH" --section-name-mappings "$SECTION_MAPPINGS_PATH"
92+
"$GENERATE_MARKDOWN_BIN" --input "$EXTRACTED_JSON" --output "$OUTPUT_FILE" --template "$TEMPLATE_PATH" --section-name-mappings "$SECTION_MAPPINGS_PATH"
8893

8994
log_info "Documentation generation complete!"
9095
log_info "Generated files:"
91-
log_info " - Configuration reference: $MARKDOWN_OUTPUT"
96+
log_info " - Configuration reference: $OUTPUT_FILE"
9297
log_info " - Intermediate JSON: $EXTRACTED_JSON"
9398

9499
# Verify output
95-
if [[ -f "$MARKDOWN_OUTPUT" ]]; then
96-
WORD_COUNT=$(wc -w < "$MARKDOWN_OUTPUT")
100+
if [[ -f "$OUTPUT_FILE" ]]; then
101+
WORD_COUNT=$(wc -w < "$OUTPUT_FILE")
97102
log_info "Generated Markdown contains $WORD_COUNT words"
98103
else
99-
log_error "Expected output file not found: $MARKDOWN_OUTPUT"
104+
log_error "Expected output file not found: $OUTPUT_FILE"
100105
exit 1
101106
fi
102107
}
@@ -125,7 +130,7 @@ DESCRIPTION:
125130
Source file: stackslib/src/config/mod.rs
126131
127132
OUTPUT:
128-
docs/generated/configuration-reference.md
133+
docs/generated/node-parameters.md
129134
130135
EOF
131136
}

0 commit comments

Comments
 (0)