Skip to content

Commit d9ced55

Browse files
authored
Merge pull request #167 from opsmill/develop
New docs system
2 parents 8852cc2 + 4d083bb commit d9ced55

File tree

91 files changed

+18280
-5164
lines changed

Some content is hidden

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

91 files changed

+18280
-5164
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ docker-compose.yml
55
.venv
66
.vscode/
77
.github/
8-
.ruff_cache
98
**/.ruff_cache
9+
**/.DS_Store

.github/build-docs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
cd docs && npm install && npm run build

.github/file-filters.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@ yaml_all: &yaml_all
1818
ansible_all:
1919
- *ansible_plugins
2020
- *ansible_docs
21+
22+
doc_files: &doc_files
23+
- "docs/**"
24+
- package.json
25+
- package-lock.json
26+
27+
markdown_all: &markdown_all
28+
- "**/*.{md,mdx}"
29+
30+
documentation_all:
31+
- *doc_files
32+
- *markdown_all

.github/labeler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"group/ci":
3+
- changed-files:
4+
- any-glob-to-any-file: [".github/**"]
5+
6+
"type/documentation":
7+
- changed-files:
8+
- any-glob-to-any-file: ["docs/**"]

.github/workflows/sync-docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# yamllint disable rule:truthy rule:truthy rule:line-length
3+
name: Sync Docs Folders
4+
on:
5+
push:
6+
branches:
7+
- stable
8+
paths:
9+
- 'docs/docs/**'
10+
- 'docs/sidebars.ts'
11+
12+
jobs:
13+
sync:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout source repository
17+
uses: actions/checkout@v4
18+
with:
19+
path: source-repo
20+
21+
- name: Checkout target repository
22+
uses: actions/checkout@v4
23+
with:
24+
repository: opsmill/infrahub-docs
25+
token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }}
26+
path: target-repo
27+
28+
- name: Sync folders
29+
run: |
30+
rm -rf target-repo/docs/docs-ansible/*
31+
rm -f target-repo/docs/sidebars-ansible.ts
32+
cp -r source-repo/docs/docs/* target-repo/docs/docs-ansible/
33+
cp source-repo/docs/sidebars.ts target-repo/docs/sidebars-ansible.ts
34+
cd target-repo
35+
git config user.name github-actions
36+
git config user.email [email protected]
37+
git add .
38+
if ! (git diff --quiet && git diff --staged --quiet); then git commit -m "Sync docs from infrahub-ansible repo" && git push; fi

.github/workflows/trigger-push-stable.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ jobs:
5151
virtualenvs-in-project: true
5252
installer-parallel: true
5353

54-
5554
- uses: actions/checkout@v4
5655
with:
5756
token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }}

.github/workflows/workflow-changelog-and-docs.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,39 @@ jobs:
1919
token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }}
2020
fetch-depth: 0
2121

22-
- name: Set up Python
23-
uses: actions/setup-python@v5
22+
- name: "Set up Python"
23+
uses: "actions/setup-python@v5"
2424
with:
25-
python-version: 3.11
25+
python-version: "3.11"
2626

2727
- name: Install antsibull-changelog, antsichaut
28-
run: python -m pip install toml invoke antsibull-changelog antsibull-docs antsichaut --disable-pip-version-check
29-
30-
- name: Install pandoc
31-
run: sudo apt-get install pandoc
28+
run: python -m pip install toml invoke --disable-pip-version-check
3229

3330
- name: "Generate Docs"
3431
run: "invoke generate-doc"
3532

36-
- name: Generate new version in changelog.yaml
37-
run: antsibull-changelog release -v --version "${{ inputs.version }}"
38-
39-
- name: Generate changelog.yaml
40-
run: antsichaut
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
SINCE_VERSION: "${{ steps.previoustag.outputs.tag }}"
44-
45-
- name: Update Changelog.rst
46-
run: antsibull-changelog generate -v
33+
- name: Sync folders
34+
run: |
35+
rm -rf target-repo/docs/docs-ansible/*
36+
rm -f target-repo/docs/sidebars-ansible.ts
37+
cp -r source-repo/docs/docs/* target-repo/docs/docs-ansible/
38+
cp source-repo/docs/sidebars.ts target-repo/docs/sidebars-ansible.ts
39+
cd target-repo
40+
git config user.name github-actions
41+
git config user.email [email protected]
42+
git add .
43+
if ! (git diff --quiet && git diff --staged --quiet); then
44+
git commit -m "Sync docs from infrahub-ansible repo"
45+
git push
46+
fi
4747
4848
- name: commit changelog and docs
4949
uses: github-actions-x/[email protected]
5050
with:
5151
github-token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }}
5252
push-branch: 'stable'
5353
commit-message: 'chore: update changelog & docs'
54-
files: docs/ CHANGELOG.rst changelogs/
54+
files: docs/
5555
name: opsmill-bot
5656
5757
rebase: true

.github/workflows/workflow-linter.yml

Lines changed: 86 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}
1515
cancel-in-progress: true
1616

17+
env:
18+
VALE_VERSION: "3.7.1"
19+
YAMLLINT_VERSION: "1.35.1"
20+
1721
jobs:
1822
files-changed:
1923
name: Detect which file has changed
@@ -22,6 +26,7 @@ jobs:
2226
outputs:
2327
python: ${{ steps.changes.outputs.python_all }}
2428
yaml: ${{ steps.changes.outputs.yaml_all }}
29+
documentation: ${{ steps.changes.outputs.documentation_all }}
2530
steps:
2631
- name: "Check out repository code"
2732
uses: "actions/checkout@v4"
@@ -49,33 +54,108 @@ jobs:
4954
- '**.yml'
5055
- '**.yaml'
5156
- name: "Setup environment"
52-
run: "pip install yamllint==1.29.0"
57+
run: "pip install yamllint==${{ env.YAMLLINT_VERSION }}"
5358
- name: "Linting: yamllint"
5459
run: "yamllint ."
5560

5661
python-lint:
5762
if: needs.files-changed.outputs.python == 'true'
5863
needs: ["files-changed"]
5964
runs-on: "ubuntu-22.04"
65+
strategy:
66+
matrix:
67+
python-version:
68+
- "3.12"
69+
poetry-version:
70+
- "1.8.5"
6071
timeout-minutes: 5
6172
steps:
6273
- name: "Check out repository code"
6374
uses: "actions/checkout@v4"
64-
- name: "Setup environment"
65-
run: "pip install ruff==0.9.1"
75+
76+
- name: "Set up Python ${{ matrix.python-version }}"
77+
uses: "actions/setup-python@v5"
78+
with:
79+
python-version: ${{ matrix.python-version }}
80+
- name: "Install Poetry ${{ matrix.poetry-version }}"
81+
uses: "snok/install-poetry@v1"
82+
with:
83+
version: ${{ matrix.poetry-version }}
84+
virtualenvs-create: true
85+
virtualenvs-in-project: true
86+
installer-parallel: true
87+
- name: "Setup Python environment"
88+
run: |
89+
poetry config virtualenvs.create true --local
90+
poetry env use ${{ matrix.python-version }}
91+
- name: "Install dependencies"
92+
run: "poetry install --no-interaction --no-ansi --with dev"
93+
6694
- name: "Linting: ruff check"
67-
run: "ruff check ."
95+
run: "poetry run ruff check ."
6896
- name: "Linting: ruff format"
69-
run: "ruff format --check --diff ."
97+
run: "poetry run ruff format --check --diff ."
7098

7199
ansible-lint:
72100
name: ansible-lint
73101
runs-on: "ubuntu-22.04"
74102
steps:
75-
# Important: This sets up your GITHUB_WORKSPACE environment variable
76103
- uses: actions/checkout@v4
77104
with:
78105
fetch-depth: 0
79106

80107
- name: Run ansible-lint
81108
uses: ansible/ansible-lint-action@v6
109+
110+
documentation-lint:
111+
defaults:
112+
run:
113+
working-directory: ./docs
114+
if: needs.files-changed.outputs.documentation == 'true'
115+
needs: ["files-changed", "yaml-lint", "python-lint"]
116+
runs-on: "ubuntu-22.04"
117+
timeout-minutes: 5
118+
steps:
119+
- name: "Check out repository code"
120+
uses: "actions/checkout@v4"
121+
with:
122+
submodules: true
123+
- name: Install NodeJS
124+
uses: actions/setup-node@v4
125+
with:
126+
node-version: 20
127+
cache: 'npm'
128+
cache-dependency-path: docs/package-lock.json
129+
- name: "Install dependencies"
130+
run: npm install
131+
- name: "Setup Python environment"
132+
run: "pip install invoke toml"
133+
- name: "Build docs website"
134+
run: "invoke docusaurus"
135+
136+
validate-documentation-style:
137+
needs: ["files-changed", "yaml-lint", "python-lint"]
138+
runs-on: "ubuntu-22.04"
139+
timeout-minutes: 5
140+
steps:
141+
- name: "Check out repository code"
142+
uses: "actions/checkout@v4"
143+
with:
144+
submodules: true
145+
146+
# The official GitHub Action for Vale doesn't work, installing manually instead:
147+
# https://github.com/errata-ai/vale-action/issues/103
148+
- name: Download Vale
149+
run: |
150+
curl -sL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/\
151+
vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o vale.tar.gz
152+
tar -xzf vale.tar.gz
153+
env:
154+
VALE_VERSION: ${{ env.VALE_VERSION }}
155+
156+
- name: "Validate documentation style"
157+
run: |
158+
./vale $(find ./docs -type f \(
159+
-name "*.mdx" \
160+
-o -name "*.md" \
161+
\) )

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
*.tar.gz
2-
__pycache__/
2+
**/__pycache__
33
*.pyc
44
tests/output/*
55
venv/
66
.venv/
77
.vscode/
88
.idea/
9-
changelogs/.plugin-cache.yaml
109
docs/_build/*
1110
**/.ruff_cache
11+
**/.DS_Store
1212
.python-version
13-
.DS_Store
1413

1514
# https://github.com/ansible/ansible/issues/68499
1615
# ansible_collections/

.markdownlint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
default: true
3+
MD007:
4+
indent: 4 # sets indent size to 4 spaces
5+
MD013: false # disables max line-length
6+
MD024: false # disables 'no duplicate headings',
7+
# which we use in tabs for instructions
8+
MD025:
9+
front_matter_title: "" # prevent collisions with h1s
10+
# and frontmatter titles
11+
MD029: false # allows manually creating ordered lists
12+
MD033: false # allows inline html to override markdown styles
13+
MD034: false # no-bare-urls
14+
MD045: false # no alt text around images
15+
MD047: false # single trailing newline
16+
MD014: false # dollar signs used before commands

.readthedocs.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.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

.vale/styles/Infrahub/colon-space.yml

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+[.?!]'

0 commit comments

Comments
 (0)