Skip to content

Commit ee27da6

Browse files
committed
init migration python sdk doc
1 parent 81c7493 commit ee27da6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+19768
-1
lines changed

.github/file-filters.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ poetry_files: &poetry_files
1919

2020
doc_files: &doc_files
2121
- "docs/**"
22+
- package.json
23+
- package-lock.json
2224

2325
python_all: &python_all
2426
- "**/*.py"

.github/workflows/ci.yml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
INFRAHUB_IMAGE_VER: "local"
2525
PYTEST_XDIST_WORKER_COUNT: 4
2626
INFRAHUB_TEST_IN_DOCKER: 1
27-
VALE_VERSION: "3.0.7"
27+
VALE_VERSION: "3.7.1"
2828
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
2929
METRICS_ENDPOINT: ${{ secrets.METRICS_ENDPOINT }}
3030

@@ -115,6 +115,62 @@ jobs:
115115
SHELLCHECK_OPTS: --exclude=SC2086 --exclude=SC2046 --exclude=SC2004 --exclude=SC2129
116116

117117

118+
documentation:
119+
defaults:
120+
run:
121+
working-directory: ./docs
122+
if: |
123+
always() && !cancelled() &&
124+
!contains(needs.*.result, 'failure') &&
125+
!contains(needs.*.result, 'cancelled') &&
126+
needs.files-changed.outputs.documentation == 'true'
127+
needs: ["files-changed", "yaml-lint", "python-lint"]
128+
runs-on: "ubuntu-22.04"
129+
timeout-minutes: 5
130+
steps:
131+
- name: "Check out repository code"
132+
uses: "actions/checkout@v4"
133+
with:
134+
submodules: true
135+
- name: Install NodeJS
136+
uses: actions/setup-node@v4
137+
with:
138+
node-version: 20
139+
cache: 'npm'
140+
cache-dependency-path: docs/package-lock.json
141+
- name: "Install dependencies"
142+
run: npm install
143+
- name: "Setup Python environment"
144+
run: "pip install invoke toml"
145+
- name: "Build docs website"
146+
run: "invoke docs"
147+
148+
149+
validate-documentation-style:
150+
if: |
151+
always() && !cancelled() &&
152+
!contains(needs.*.result, 'failure') &&
153+
!contains(needs.*.result, 'cancelled')
154+
needs: ["files-changed", "yaml-lint", "python-lint"]
155+
runs-on: "ubuntu-22.04"
156+
timeout-minutes: 5
157+
steps:
158+
- name: "Check out repository code"
159+
uses: "actions/checkout@v4"
160+
with:
161+
submodules: true
162+
163+
# The official GitHub Action for Vale doesn't work, installing manually instead:
164+
# https://github.com/errata-ai/vale-action/issues/103
165+
- name: Download Vale
166+
run: |
167+
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
168+
tar -xzf vale.tar.gz
169+
env:
170+
VALE_VERSION: ${{ env.VALE_VERSION }}
171+
- name: "Validate documentation style"
172+
run: ./vale $(find ./docs -type f \( -name "*.mdx" -o -name "*.md" \) )
173+
118174
unit-tests:
119175
env:
120176
# workaround for Rich table column width

.github/workflows/sync-docs.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# yamllint disable rule:truthy rule:line-length
3+
name: Sync Folders
4+
5+
on:
6+
push:
7+
branches:
8+
- stable
9+
paths:
10+
- 'docs/docs/**'
11+
- 'docs/sidebars.ts'
12+
pull_request:
13+
branches:
14+
- stable
15+
16+
jobs:
17+
sync:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout source repository
21+
uses: actions/checkout@v4
22+
with:
23+
path: source-repo
24+
25+
- name: Checkout target repository
26+
uses: actions/checkout@v4
27+
with:
28+
repository: opsmill/infrahub-docs
29+
token: ${{ secrets.PAT_TOKEN }}
30+
path: target-repo
31+
32+
- name: Sync folders
33+
run: |
34+
rm -rf target-repo/docs/docs-python-sdk/*
35+
rm -f target-repo/python_sdk/examples/*
36+
rm -f target-repo/docs/sidebars-python-sdk.ts
37+
cp -r source-repo/docs/docs/python-sdk/* target-repo/docs/docs-python-sdk
38+
cp -r source-repo/examples/* target-repo/python_sdk/examples/
39+
cp source-repo/docs/sidebars.ts target-repo/docs/sidebars-python-sdk.ts
40+
sed -i 's/python-sdk\///g' target-repo/docs/sidebars-python-sdk.ts
41+
42+
for entry in source-repo/docs/docs/*; do
43+
name=$(basename "$entry")
44+
if [ "$name" != "python-sdk" ]; then
45+
if [ -d "$entry" ]; then
46+
cp -r "$entry"/* "target-repo/docs/docs/$name/"
47+
elif [ -f "$entry" ]; then
48+
cp "$entry" "target-repo/docs/docs/"
49+
fi
50+
fi
51+
done
52+
53+
cd target-repo
54+
git config user.name github-actions
55+
git config user.email [email protected]
56+
git add .
57+
if ! (git diff --quiet && git diff --staged --quiet); then git commit -m "Sync doc Python SDK from infrahub repo" && git push; fi

.vale.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
StylesPath = .vale/styles
2+
3+
MinAlertLevel = warning
4+
5+
[formats]
6+
mdx = md
7+
8+
[docs/**/*.md]
9+
BasedOnStyles = Infrahub
10+
;(import.*?\n) to ignore import statement in .mdx
11+
;(```.*?```\n) to ignore code block in .mdx
12+
BlockIgnores = (?s) *((import.*?\n)|(```.*?```\n))
13+
14+
[*]
15+
BasedOnStyles = Infrahub
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
extends: substitution
3+
message: Use '%s' instead of '%s'
4+
level: error
5+
ignorecase: false
6+
action:
7+
name: replace
8+
swap:
9+
(?i:[^/]Github): GitHub
10+
(?i:gitpod): GitPod
11+
(?i:[^/]Graphql): GraphQL
12+
infrahub(?:\s|$): Infrahub
13+
(?i:Openconfig): OpenConfig
14+
opsmill(?:\s|$): OpsMill
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
extends: substitution
3+
message: "Use a space after a colon, but not before"
4+
level: warning
5+
ignorecase: true
6+
nonword: true
7+
swap:
8+
'(?<=\s):(?=\s+)': ': '

.vale/styles/Infrahub/eg-ie.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: substitution
3+
message: "Instead of %s, use ',i.e.,' or 'for example:'."
4+
level: warning
5+
ignorecase: true
6+
nonword: true
7+
action:
8+
name: replace
9+
swap:
10+
- e\.g\.: i.e.
11+
- e\. g\.: i.e.
12+
- i\. e\.: i.e.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
extends: existence
3+
message: "Use a comma before the last 'and' or 'or' in a list of items."
4+
level: suggestion
5+
scope: sentence
6+
nonword: true
7+
tokens:
8+
- '(?:[^\s,]+,){1,} \w+ (?:and|or) \w+[.?!]'
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
extends: capitalization
3+
message: "'%s' should use sentence case"
4+
level: warning
5+
scope:
6+
- heading.h1
7+
- heading.h2
8+
- heading.h3
9+
- heading.h4
10+
- heading.h5
11+
- heading.h6
12+
match: $sentence
13+
exceptions:
14+
- Alpha
15+
- Ansible
16+
- API
17+
- Attributes
18+
- AWS S3
19+
- Beta
20+
- BGP
21+
- CA certificates
22+
- CI
23+
- Codespaces
24+
- Computed Attribute
25+
- Computed Attributes
26+
- CoreArtifactTarget
27+
- CoreRepository
28+
- CoreGroup
29+
- Docker Compose
30+
- E2E
31+
- Generics
32+
- Git
33+
- GitHub
34+
- GitHub Codespaces
35+
- GitLab
36+
- GitPod
37+
- GraphQL
38+
- GraphQLQuery
39+
- include_in_menu & menu_placement
40+
- Helm
41+
- High Availability
42+
- Human Friendly Identifier
43+
- Infrahub
44+
- infrahubctl
45+
- IPHost
46+
- IP
47+
- IPAM
48+
- IPNetwork
49+
- IP Fabric
50+
- JavaScript
51+
- JetStream
52+
- Jinja
53+
- Jinja2
54+
- JWT
55+
- Namespace
56+
- NATS
57+
- Node
58+
- OAuth2
59+
- OIDC
60+
- Open ID Connect
61+
- OpsMill
62+
- Pydantic
63+
- Python
64+
- RabbitMQ
65+
- REST
66+
- RFile
67+
- SDK
68+
- Single sign-on
69+
- SSO
70+
- TLS
71+
- Tony Stark
72+
- TransformPython
73+
- Trusted Root Certificate Store
74+
- UI
75+
- Vale
76+
- VS Code
77+
- VS Code extensions
78+
- WebUI
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
extends: existence
3+
message: "Remove %s and avoid words that minimize the effort level required."
4+
level: warning
5+
ignorecase: true
6+
tokens:
7+
- easy
8+
- simple
9+
- simply

0 commit comments

Comments
 (0)