Skip to content

Commit 545d365

Browse files
committed
Set up documentation (#334)
This PR adds some auto-generated (i.e. terrible) documentation. It's a start at least. Maybe we can copy (and update) some parts from the Turing docs. Probably at least want to split it up into different areas, e.g., "@model macro", "Sampler","@prob macro", "VarInfo" etc. I think it's easier to review if such major changes are performed in subsequent PRs. Not all exported functions and types were documented and so I had to add some docstrings (e.g. for `@submodel`). Edit: You can have a look at the preview here: https://turinglang.github.io/DynamicPPL.jl/previews/PR334/ (you can also just click on "Details" for "documenter/deploy" in the Github action status checks below) Co-authored-by: David Widmann <[email protected]>
1 parent dd1d301 commit 545d365

File tree

16 files changed

+247
-7
lines changed

16 files changed

+247
-7
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ jobs:
1313
- name: CompatHelper.main()
1414
env:
1515
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
17-
run: julia -e 'using CompatHelper; CompatHelper.main(; subdirs = ["", "test", "test/turing"])'
16+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
17+
run: julia -e 'using CompatHelper; CompatHelper.main(; subdirs = ["", "docs", "test", "test/turing"])'

.github/workflows/Docs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
# This is where pull requests from "bors r+" are built.
7+
- staging
8+
# This is where pull requests from "bors try" are built.
9+
- trying
10+
# Build the master branch.
11+
- master
12+
tags: '*'
13+
pull_request:
14+
15+
concurrency:
16+
# Skip intermediate builds: always.
17+
# Cancel intermediate builds: only if it is a pull request build.
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
20+
21+
jobs:
22+
docs:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: julia-actions/setup-julia@latest
27+
with:
28+
version: '1'
29+
- name: Install dependencies
30+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
31+
- name: Build and deploy
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
34+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
35+
JULIA_DEBUG: Documenter # Print `@debug` statements (https://github.com/JuliaDocs/Documenter.jl/issues/955)
36+
run: julia --project=docs/ docs/make.jl
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: DocsPreviewCleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout gh-pages branch
12+
uses: actions/checkout@v2
13+
with:
14+
ref: gh-pages
15+
- name: Delete preview and history + push changes
16+
run: |
17+
if [ -d "previews/PR$PRNUM" ]; then
18+
git config user.name "Documenter.jl"
19+
git config user.email "[email protected]"
20+
git rm -rf "previews/PR$PRNUM"
21+
git commit -m "delete preview"
22+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
23+
git push --force origin gh-pages-new:gh-pages
24+
fi
25+
env:
26+
PRNUM: ${{ github.event.number }}

.github/workflows/Format.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
- master
1212
pull_request:
1313

14+
concurrency:
15+
# Skip intermediate builds: always.
16+
# Cancel intermediate builds: only if it is a pull request build.
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
19+
1420
jobs:
1521
format:
1622
runs-on: ubuntu-latest

.github/workflows/TagBot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ jobs:
1212
- uses: JuliaRegistries/TagBot@v1
1313
with:
1414
token: ${{ secrets.GITHUB_TOKEN }}
15+
ssh: ${{ secrets.DOCUMENTER_KEY }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# DynamicPPL.jl
22

3+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://turinglang.github.io/DynamicPPL.jl/stable)
4+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://turinglang.github.io/DynamicPPL.jl/dev)
35
[![CI](https://github.com/TuringLang/DynamicPPL.jl/workflows/CI/badge.svg?branch=master)](https://github.com/TuringLang/DynamicPPL.jl/actions?query=workflow%3ACI+branch%3Amaster)
46
[![JuliaNightly](https://github.com/TuringLang/DynamicPPL.jl/workflows/JuliaNightly/badge.svg?branch=master)](https://github.com/TuringLang/DynamicPPL.jl/actions?query=workflow%3AJuliaNightly+branch%3Amaster)
57
[![IntegrationTest](https://github.com/TuringLang/DynamicPPL.jl/workflows/IntegrationTest/badge.svg?branch=master)](https://github.com/TuringLang/DynamicPPL.jl/actions?query=workflow%3AIntegrationTest+branch%3Amaster)

bors.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ status = [
77
"test (1, macOS-latest, x64, 2)",
88
"test (1, windows-latest, x64, 2)",
99
"Turing.jl",
10-
"format"
10+
"format",
11+
"docs"
1112
]
1213
delete_merged_branches = true
1314
# Require at least on approval of a project member.

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

docs/Project.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[deps]
2+
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
3+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
5+
6+
[compat]
7+
Distributions = "0.25"
8+
Documenter = "0.27"
9+
StableRNGs = "1"

docs/make.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Documenter
2+
using DynamicPPL
3+
4+
# Doctest setup
5+
DocMeta.setdocmeta!(DynamicPPL, :DocTestSetup, :(using DynamicPPL); recursive=true)
6+
7+
makedocs(;
8+
sitename="DynamicPPL",
9+
format=Documenter.HTML(),
10+
modules=[DynamicPPL],
11+
pages=["Home" => "index.md"],
12+
strict=true,
13+
checkdocs=:exports,
14+
doctestfilters=[
15+
# Older versions will show "0 element Array" instead of "Type[]".
16+
r"(Any\[\]|0-element Array{.+,[0-9]+})",
17+
# Older versions will show "Array{...,1}" instead of "Vector{...}".
18+
r"(Array{.+,\s?1}|Vector{.+})",
19+
# Older versions will show "Array{...,2}" instead of "Matrix{...}".
20+
r"(Array{.+,\s?2}|Matrix{.+})",
21+
],
22+
)
23+
24+
deploydocs(; repo="github.com/TuringLang/DynamicPPL.jl.git", push_preview=true)

0 commit comments

Comments
 (0)