Skip to content
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

add docusaurus #53

Merged
merged 4 commits into from
Jan 31, 2025
Merged
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
3 changes: 3 additions & 0 deletions .github/build-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

cd docs && npm install && npm run build
8 changes: 8 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"group/ci":
- changed-files:
- any-glob-to-any-file: [".github/**"]

"type/documentation":
- changed-files:
- any-glob-to-any-file: ["docs/**"]
38 changes: 38 additions & 0 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# yamllint disable rule:truthy rule:truthy rule:line-length
name: Sync Docs Folders
on:
push:
branches:
- main
paths:
- 'docs/docs/**'
- 'docs/sidebars.ts'

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
path: source-repo

- name: Checkout target repository
uses: actions/checkout@v4
with:
repository: opsmill/infrahub-docs
token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }}
path: target-repo

- name: Sync folders
run: |
rm -rf target-repo/docs/docs-sync/*
rm -f target-repo/docs/sidebars-sync.ts
cp -r source-repo/docs/docs/* target-repo/docs/docs-sync/
cp source-repo/docs/sidebars.ts target-repo/docs/sidebars-sync.ts
cd target-repo
git config user.name github-actions
git config user.email [email protected]
git add .
if ! (git diff --quiet && git diff --staged --quiet); then git commit -m "Sync docs from infrahub-demo-dc-fabric repo" && git push; fi
62 changes: 60 additions & 2 deletions .github/workflows/workflow-linter.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# yamllint disable rule:truthy
# yamllint disable rule:truthy rule:truthy rule:line-length
name: "Run linter"
on:
workflow_call:
Expand All @@ -14,6 +14,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
VALE_VERSION: "3.7.1"

jobs:
files-changed:
name: Detect which file has changed
Expand Down Expand Up @@ -105,7 +108,7 @@ jobs:
- name: "Linting: markdownlint"
uses: DavidAnson/markdownlint-cli2-action@v19
with:
config: .markdownlint.yaml
config: .markdownlint.yml
globs: |
**/*.{md,mdx}
!changelog/*.md
Expand All @@ -125,3 +128,58 @@ jobs:
shell: bash
env:
SHELLCHECK_OPTS: --exclude=SC2086 --exclude=SC2046 --exclude=SC2004

documentation:
defaults:
run:
working-directory: ./docs
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.files-changed.outputs.documentation == 'true'
needs: ["files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
submodules: true
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: "Install dependencies"
run: npm install
- name: "Setup Python environment"
run: "pip install invoke toml"
- name: "Build docs website"
run: "invoke docusaurus"

validate-documentation-style:
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
needs: ["files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
submodules: true

# The official GitHub Action for Vale doesn't work, installing manually instead:
# https://github.com/errata-ai/vale-action/issues/103
- name: Download Vale
run: |
curl -sL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o vale.tar.gz
tar -xzf vale.tar.gz
env:
VALE_VERSION: ${{ env.VALE_VERSION }}
- name: "Validate documentation style"
run: ./vale $(find ./docs -type f \( -name "*.mdx" -o -name "*.md" \) )
13 changes: 0 additions & 13 deletions .markdownlint.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
default: true
MD007:
indent: 4 # sets indent size to 4 spaces
MD013: false # disables max line-length
MD024: false # disables 'no duplicate headings',
# which we use in tabs for instructions
MD025:
front_matter_title: "" # prevent collisions with h1s
# and frontmatter titles
MD029: false # allows manually creating ordered lists
MD033: false # allows inline html to override markdown styles
MD034: false # no-bare-urls
MD045: false # no alt text around images
MD047: false # single trailing newline
MD014: false # dollar signs used before commands
MD0001:
ignore:
- "docs/README.md"
15 changes: 15 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
StylesPath = .vale/styles

MinAlertLevel = warning

[formats]
mdx = md

[docs/**/*.md]
BasedOnStyles = Infrahub
;(import.*?\n) to ignore import statement in .mdx
;(```.*?```\n) to ignore code block in .mdx
BlockIgnores = (?s) *((import.*?\n)|(```.*?```\n))

[*]
BasedOnStyles = Infrahub
14 changes: 14 additions & 0 deletions .vale/styles/Infrahub/branded-terms-case-swap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
extends: substitution
message: Use '%s' instead of '%s'
level: error
ignorecase: false
action:
name: replace
swap:
(?i:[^/]Github): GitHub
(?i:gitpod): GitPod
(?i:[^/]Graphql): GraphQL
infrahub(?:\s|$): Infrahub
(?i:Openconfig): OpenConfig
opsmill(?:\s|$): OpsMill
8 changes: 8 additions & 0 deletions .vale/styles/Infrahub/colon-space.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extends: substitution
message: "Use a space after a colon, but not before"
level: warning
ignorecase: true
nonword: true
swap:
'(?<=\s):(?=\s+)': ': '
12 changes: 12 additions & 0 deletions .vale/styles/Infrahub/eg-ie.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
extends: substitution
message: "Instead of %s, use ',i.e.,' or 'for example:'."
level: warning
ignorecase: true
nonword: true
action:
name: replace
swap:
- e\.g\.: i.e.
- e\. g\.: i.e.
- i\. e\.: i.e.
8 changes: 8 additions & 0 deletions .vale/styles/Infrahub/oxford-comma.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extends: existence
message: "Use a comma before the last 'and' or 'or' in a list of items."
level: suggestion
scope: sentence
nonword: true
tokens:
- '(?:[^\s,]+,){1,} \w+ (?:and|or) \w+[.?!]'
75 changes: 75 additions & 0 deletions .vale/styles/Infrahub/sentence-case.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
extends: capitalization
message: "'%s' should use sentence case"
level: warning
scope:
- heading.h1
- heading.h2
- heading.h3
- heading.h4
- heading.h5
- heading.h6
match: $sentence
exceptions:
- Alpha
- Ansible
- API
- Attributes
- AWS S3
- Beta
- BGP
- CA certificates
- CI
- Codespaces
- CoreArtifactTarget
- CoreRepository
- CoreGroup
- Docker Compose
- E2E
- Generics
- Git
- GitHub
- GitHub Codespaces
- GitLab
- GitPod
- GraphQL
- GraphQLQuery
- include_in_menu & menu_placement
- Helm
- High Availability
- Human Friendly Identifier
- Infrahub
- infrahubctl
- IPHost
- IP
- IPAM
- IPNetwork
- IP Fabric
- JavaScript
- JetStream
- Jinja
- Jinja2
- JWT
- Namespace
- NATS
- Node
- OAuth2
- OIDC
- Open ID Connect
- OpsMill
- Pydantic
- Python
- RabbitMQ
- REST
- RFile
- SDK
- Single sign-on
- SSO
- TLS
- Tony Stark
- TransformPython
- UI
- Vale
- VS Code
- VS Code extensions
- WebUI
9 changes: 9 additions & 0 deletions .vale/styles/Infrahub/simple-easy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: existence
message: "Remove %s and avoid words that minimize the effort level required."
level: warning
ignorecase: true
tokens:
- easy
- simple
- simply
8 changes: 8 additions & 0 deletions .vale/styles/Infrahub/spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extends: spelling
message: "Did you really mean '%s'?"
level: error
filters:
- '[pP]y.*\b'
- '\bimport_.*\b' # New filter to ignore variables starting with 'import_'
ignore: spelling-exceptions.txt
10 changes: 10 additions & 0 deletions .vale/styles/Infrahub/swap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
extends: substitution
message: "Use '%s' instead of '%s'"
level: error
ignorecase: true
action:
name: replace
swap:
config\b(?!\.\w): configuration
repo: repository
Loading