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
72 changes: 72 additions & 0 deletions .github/workflows/user-guide.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: User Guide

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
PYTHON_VRSN: '3.13'
VENV_PATH: 'doc/.venv'

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup uv with Python ${{ env.PYTHON_VRSN }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VRSN }}

- name: Cache uv venv
uses: actions/cache@v4
with:
path: ${{ env.VENV_PATH }}
key: ${{ runner.os }}-uv-${{ env.PYTHON_VRSN }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-${{ env.PYTHON_VRSN }}-

- name: Install dependencies
working-directory: ./doc
run: uv sync

- name: Lint Sphinx docs
working-directory: ./doc
run: uv run sphinx-lint source

- name: Build HTML docs
working-directory: ./doc
run: uv run make clean html

- name: Minimize uv cache
run: uv cache prune --ci

# -- Deploy to GitHub Pages only on push to upstream main
- name: Setup GitHub Pages
if: ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'merge_group') }}
uses: actions/configure-pages@v5

- name: Upload artifact to GitHub Pages
if: ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'merge_group') }}
uses: actions/upload-pages-artifact@v4
with:
name: github-pages
path: doc/build/html
retention-days: 1

- name: Deploy to GitHub Pages
id: deployment
if: ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'merge_group') }}
uses: actions/deploy-pages@v4
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
*~
__pycache__/
results/*.png
results/*.txt
processed_data/*.dat
.*.sw?

# ignore build output
*build/
*_build/
user_guide/doc/_build
user_guide/doc/build

# ignore VS Code files
/.idea

# ignore envs
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# UV
*uv.lock
.python-version
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# JULES - Joint UK Land Environment Simulator

The Joint UK Land Environment Simulator (JULES) is a computer model that
simulates many soil and vegetation processes.
28 changes: 28 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

REPO := $(notdir $(shell git rev-parse --show-toplevel))
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
DEPLOYDIR = $(HOME)/public_html

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

deploy:
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(DEPLOYDIR)/$(REPO)/$(BRANCH)" $(SPHINXOPTS) $(O)

29 changes: 29 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Building the JULES User Guide

This README describes how to build the JULES User Guide.

For first time users, please create a virtual environment to build the docs.

From the `jules/doc` folder of the repository run:

```sh
conda env create -f environment.yml
```

Activate the environment:

```sh
conda activate jules-user-guide
```

Build the documentation:

```sh
make clean html
```

View the documentation:

```sh
firefox build/html/index.html
```
11 changes: 11 additions & 0 deletions doc/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: jules-user-guide

channels:
- conda-forge

dependencies:
- python=3.13.2
- doc8>=2.0.0
- sphinx-lint==1.0.1
- sphinx==8.2.3

35 changes: 35 additions & 0 deletions doc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
11 changes: 11 additions & 0 deletions doc/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[project]
name = "jules"
version = "8.0.0"
description = "Joint UK Land Environment Simulator User Guide"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"doc8>=2.0.0",
"sphinx==8.2.3",
"sphinx-lint==1.0.1",
]
Loading