Skip to content

Commit 40cdf9c

Browse files
committed
Bootstrap the mkdocs project and add CI/CD
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
1 parent 306183e commit 40cdf9c

10 files changed

Lines changed: 905 additions & 4 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release Github Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
- name: Configure Git Credentials
17+
run: |-
18+
git config user.name "$GITHUB_ACTOR"
19+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
20+
- uses: actions/setup-python@v6
21+
- uses: abatilo/actions-poetry@v3
22+
- name: Build and deploy the mkdocs site
23+
run: |-
24+
poetry install --no-root
25+
poetry run mkdocs gh-deploy --force

.github/workflows/test-mkdocs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test code and mkdocs build
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
- uses: actions/setup-python@v6
14+
- uses: pre-commit/action@v3.0.1
15+
- uses: abatilo/actions-poetry@v3
16+
- name: Build the mkdocs site
17+
run: |-
18+
poetry install --no-root
19+
poetry run mkdocs build

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace
7+
- repo: https://github.com/codespell-project/codespell
8+
rev: v2.4.1
9+
hooks:
10+
- id: codespell

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
# documentation
2-
How to use and develop the DB Operator
1+
# DB Operator Documentation
2+
3+
## How to develop
4+
5+
### With poetry
6+
7+
1. Install poetry: <https://python-poetry.org/docs>
8+
2. Run `poetry install --no-root`
9+
3. Run `poetry run mkdocs serve`
10+
11+
### Pre commit hook
12+
13+
It's not required to use the `pre-commit` hooks, cause they will run anyway during `CI`, but if you want to see the issues before pushing, it's recommended to set it up. Please find more info here: <https://pre-commit.com/>

docs/development/helm-charts.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Helm Chart development
2+
3+
The repository where the helm charts are being developed can be found here: <https://github.com/db-operator/charts>
4+
5+
## Tools
6+
7+
Tools that are used for development:
8+
9+
- helm: <https://helm.sh>
10+
- helmfile (used for testing): <https://helmfile.readthedocs.io/en/latest/>
11+
- helm-unittest: <https://github.com/helm-unittest/helm-unittest>
12+
- chart-testing: <https://github.com/helm/chart-testing>
13+
- helm-docs: <https://github.com/norwoodj/helm-docs>
14+
- pre-commit: <https://pre-commit.com>
15+
16+
## CRD management
17+
18+
In our case it seemed like a good idea to install CRDs using the helm templates, as the db-operator chart itself doesn't depend on them. In order not to maintain them by hands, we've written a script `./scripts/sync_crds.sh`, that is getting a desired version from the db-operator's `Chart.yaml` and syncs CRDs from the operator repository.
19+
20+
Let's say you have changed something in CRDs and want to test your change with the helm chart before the change is merged in the operator repository.
21+
22+
```shell
23+
yq -i '.appVersion = "${GIT_SHA}"' ./charts/db-operator/Chart.yaml
24+
./scripts/sync_crds.sh
25+
```
26+
27+
After that, CRDs will be up-to-date with the operator repo and you can test your changes.
28+
##

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Getting Started
2+
3+
4+
5+
## Install db-operator
6+
7+
## Create a DbInstance
8+
9+
## Create a Database

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
site_name: DB Operator
2+
theme:
3+
name: material
4+
language: en

poetry.lock

Lines changed: 776 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[project]
2+
name = "documentation"
3+
version = "0.1.0"
4+
description = "Mkdocs site about the db-operator"
5+
authors = [
6+
{name = "Nikolai Rodionov",email = "allanger@badhouseplants.net"}
7+
]
8+
license = {text = "MIT"}
9+
readme = "README.md"
10+
requires-python = ">=3.12"
11+
dependencies = [
12+
"mkdocs (>=1.6.1,<2.0.0)",
13+
"mkdocs-material (>=9.7.1,<10.0.0)"
14+
]
15+
16+
17+
[build-system]
18+
requires = ["poetry-core>=2.0.0,<3.0.0"]
19+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)