Skip to content

Commit

Permalink
Merge pull request #469 from okp4/docs/predicate-documentation
Browse files Browse the repository at this point in the history
Docs/predicate documentation
  • Loading branch information
ccamel authored Oct 27, 2023
2 parents 14c0114 + b8f2af4 commit c51665e
Show file tree
Hide file tree
Showing 35 changed files with 1,035 additions and 144 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ jobs:
run: |
make doc-proto
- name: Generate predicates documentation
run: |
make doc-predicate
- name: Check Git diff in generated files (proto + docs)
run: |
if [[ $(git status -s | grep --fixed-strings -v "go.mod" | grep --fixed-strings -v "go.sum") != "" ]]; then
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/update-draft-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,21 @@ jobs:
"draft": "true"
}
}
- name: Update predicates docs repository
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.github.com/repos/okp4/docs/actions/workflows/39152549/dispatches'
method: 'POST'
customHeaders: '{"Accept": "application/vnd.github+json", "Authorization": "Bearer ${{ secrets.OKP4_TOKEN }}"}'
data: |-
{
"ref": "main",
"inputs": {
"version": "main",
"repository": "${{github.repository}}",
"section": "predicates",
"docs_directory": "docs/predicate/*",
"draft": "true"
}
}
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ proto-gen: proto-build ## Generate all the code from the Protobuf files

## Documentation:
.PHONY: doc
doc: doc-proto doc-command ## Generate all the documentation
doc: doc-proto doc-command doc-predicate ## Generate all the documentation

.PHONY: doc-proto
doc-proto: proto-gen ## Generate the documentation from the Protobuf files
Expand Down Expand Up @@ -381,12 +381,10 @@ doc-proto: proto-gen ## Generate the documentation from the Protobuf files
.PHONY: doc-command
doc-command: ## Generate markdown documentation for the command
@echo "${COLOR_CYAN} 📖 Generate markdown documentation for the command${COLOR_RESET}"
@cd docs; \
OUT_FOLDER="command"; \
@OUT_FOLDER="docs/command"; \
rm -rf $$OUT_FOLDER; \
go version; \
go get ./scripts; \
go run ../scripts/generate_command_doc.go; \
go run ./scripts/. command; \
sed -i $(SED_FLAG) 's/(default \"\/.*\/\.okp4d\")/(default \"\/home\/john\/\.okp4d\")/g' $$OUT_FOLDER/*.md; \
sed -i $(SED_FLAG) 's/node\ name\ (default\ \".*\")/node\ name\ (default\ \"my-machine\")/g' $$OUT_FOLDER/*.md; \
sed -i $(SED_FLAG) 's/IP\ (default\ \".*\")/IP\ (default\ \"127.0.0.1\")/g' $$OUT_FOLDER/*.md; \
Expand All @@ -395,7 +393,21 @@ doc-command: ## Generate markdown documentation for the command
docker run --rm \
-v `pwd`:/usr/src/docs \
-w /usr/src/docs \
${DOCKER_IMAGE_MARKDOWNLINT} -f $$OUT_FOLDER
${DOCKER_IMAGE_MARKDOWNLINT} -f $$OUT_FOLDER -c docs/.markdownlint.yaml

.PHONY: doc-predicate
doc-predicate: ## Generate markdown documentation for all the predicates (module logic)
@echo "${COLOR_CYAN} 📖 Generate markdown documentation for the predicates${COLOR_RESET}"
@OUT_FOLDER="docs/predicate"; \
rm -rf $$OUT_FOLDER; \
mkdir -p $$OUT_FOLDER; \
go get ./scripts; \
go run ./scripts/. predicate; \
docker run --rm \
-v `pwd`:/usr/src/docs \
-w /usr/src/docs \
${DOCKER_IMAGE_MARKDOWNLINT} -f $$OUT_FOLDER -c docs/.markdownlint.yaml


## Mock:
.PHONY: mock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ okp4d tx gov submit-legacy-proposal software-upgrade [name] (--upgrade-height [h
--aux Generate aux signer data instead of sending a tx
-b, --broadcast-mode string Transaction broadcasting mode (sync|async) (default "sync")
--chain-id string The network chain ID (default "okp4d")
--daemon-name string The name of the executable being upgraded (for upgrade-info validation). Default is the DAEMON_NAME env var if set, or else this executable (default "generate_command_doc")
--daemon-name string The name of the executable being upgraded (for upgrade-info validation). Default is the DAEMON_NAME env var if set, or else this executable (default "okp4d")
--deposit string deposit of proposal
--description string description of proposal
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible)
Expand Down
Loading

0 comments on commit c51665e

Please sign in to comment.