Skip to content
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
12 changes: 4 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.14
uses: actions/setup-python@v4
with:
python-version: '3.14'
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
run: uv sync --locked

# Always build docs, e.g. for testing
- name: Build docs
run: |
mkdocs build --strict
uv run mkdocs build --strict
./check-links.sh

# Only deploy on master
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site/
venv/
.venv/

# PDF generated markdown
*.pdf

2 changes: 2 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
3.14

18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ We are using mkdocs to manage our documentation.
We're really happy if you want to contribute to make the documentation better!
This is done by creating a pull request.

1. Download, install dependencies
1. Download and install dependencies

Make sure you have Python3 installed.
Install [uv](https://docs.astral.sh/uv/getting-started/installation/). It will
install the required Python version and manage the virtual environment.

```
```sh
git clone https://github.com/waterlinked/docs.git
cd docs

python -m venv venv
source venv/bin/activate (Linux)
venv\Scripts\activate.bat (Windows)
pip install -r requirements.txt
uv sync --locked

./install-hooks.sh # (Optional) To automatically check links on git push
```
Expand All @@ -29,14 +27,14 @@ pip install -r requirements.txt

3. Test them

```
mkdocs serve # Allow you to view the changes on your browser
```sh
uv run mkdocs serve # Allow you to view the changes in your browser
```
* Fire up your browser and go to localhost:8000

Verify links are valid:

```
```sh
./check-links.sh
```

Expand Down
21 changes: 7 additions & 14 deletions check-links.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@ set -e

# === Paths ===
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
VENV_BIN="$PROJECT_ROOT/venv/bin"
TMP_BUILD_DIR="$PROJECT_ROOT/.tmp-mkdocs-build"
DOCS_DIR="$PROJECT_ROOT/docs"

# Activate venv if not already activated
if [ -f "$VENV_BIN/activate" ]; then
. "$VENV_BIN/activate"
if ! command -v uv >/dev/null 2>&1; then
echo "Error: uv is required. See the README for installation instructions."
exit 1
fi

#Checking internal links in markdown files only
echo "Checking internal links in markdown files..."

set +e
#Using custom python script for internal link checking:
python "$PROJECT_ROOT/check-internal-links.py" "$DOCS_DIR"
uv run --project "$PROJECT_ROOT" python "$PROJECT_ROOT/check-internal-links.py" "$DOCS_DIR"
RESULT_INTERNAL=$?

set -e
Expand All @@ -32,23 +31,17 @@ fi

echo "Internal linkcheck passed!"

# Check if linkchecker exists
if ! command -v linkchecker >/dev/null 2>&1; then
echo "Error: linkchecker executable not found in PATH"
exit 1
fi

# Remove old temp build if it exists
rm -rf "$TMP_BUILD_DIR"

# Build MkDocs into temporary directory
echo "Building MkDocs locally into $TMP_BUILD_DIR..."
python -m mkdocs build -d "$TMP_BUILD_DIR"
uv run --project "$PROJECT_ROOT" python -m mkdocs build -d "$TMP_BUILD_DIR"

echo "Running LinkChecker on external links against local build..."
set +e
# Only report broken links
linkchecker "file://$TMP_BUILD_DIR/index.html" \
uv run --project "$PROJECT_ROOT" linkchecker "file://$TMP_BUILD_DIR/index.html" \
--no-status \
--check-extern \
--recursion-level=2 \
Expand All @@ -71,4 +64,4 @@ if [ $RESULT_EXTERNAL -ne 0 ]; then
fi

echo "External linkcheck passed!"
exit 0
exit 0
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
name = "waterlinked-docs"
version = "0.1.0"
description = "Water Linked product documentation"
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"jinja2==3.1.6",
"linkchecker==10.6.0",
"mkdocs==1.6.1",
"mkdocs-material==9.7.0",
]

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

531 changes: 531 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading