Skip to content

Commit 641c256

Browse files
authored
Set up MultiDocumenter docs (#1)
1 parent 83d320f commit 641c256

File tree

5 files changed

+128
-119
lines changed

5 files changed

+128
-119
lines changed

.github/workflows/Deploy.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Aggregate
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
aggregate:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: julia-actions/setup-julia@v1
12+
with:
13+
version: '1'
14+
- name: Install dependencies
15+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate()'
16+
- name: Aggregate and deploy
17+
run: |
18+
git config user.name github-actions
19+
git config user.email github-actions@github.com
20+
julia --project=docs/ docs/make.jl deploy

.github/workflows/Documentation.yml

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

README.md

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,10 @@
1-
# ITensorDocsNext.jl
2-
3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/ITensorDocsNext.jl/stable/)
4-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/ITensorDocsNext.jl/dev/)
5-
[![Build Status](https://github.com/ITensor/ITensorDocsNext.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/ITensorDocsNext.jl/actions/workflows/Tests.yml?query=branch%3Amain)
6-
[![Coverage](https://codecov.io/gh/ITensor/ITensorDocsNext.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/ITensorDocsNext.jl)
7-
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
8-
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
1+
# Documentation for in-progress rewrite of the ITensor ecosystem
92

103
## Support
114

125
<img src="docs/src/assets/CCQ.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo.">
136

14-
ITensorDocsNext.jl is supported by the Flatiron Institute, a division of the Simons Foundation.
15-
16-
## Installation instructions
17-
18-
This package resides in the `ITensor/ITensorRegistry` local registry.
19-
In order to install, simply add that registry through your package manager.
20-
This step is only required once.
21-
```julia
22-
julia> using Pkg: Pkg
23-
24-
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
25-
```
26-
or:
27-
```julia
28-
julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git")
29-
```
30-
if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.
31-
32-
Then, the package can be added as usual through the package manager:
33-
34-
```julia
35-
julia> Pkg.add("ITensorDocsNext")
36-
```
37-
38-
## Examples
39-
40-
````julia
41-
using ITensorDocsNext: ITensorDocsNext
42-
````
43-
44-
Examples go here.
7+
ITensor is supported by the Flatiron Institute, a division of the Simons Foundation.
458

469
---
4710

docs/make.jl

Lines changed: 104 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,112 @@
1+
# Script to build the MultiDocumenter docs
2+
#
3+
# julia --project docs/make.jl [--temp] [deploy]
4+
#
5+
# When `deploy` is passed as an argument, it goes into deployment mode
6+
# and attempts to push the generated site to gh-pages. You can also pass
7+
# `--temp`, in which case the source repositories are cloned into a temporary
8+
# directory (as opposed to `docs/clones`).
9+
using Documenter: Documenter
110
using ITensorDocsNext: ITensorDocsNext
2-
using Documenter: Documenter, DocMeta, deploydocs, makedocs
11+
using MultiDocumenter: MultiDocumenter
312

4-
DocMeta.setdocmeta!(
5-
ITensorDocsNext, :DocTestSetup, :(using ITensorDocsNext); recursive=true
6-
)
13+
clonedir = ("--temp" in ARGS) ? mktempdir() : joinpath(@__DIR__, "clones")
14+
outpath = mktempdir()
15+
@info """
16+
Cloning packages into: $(clonedir)
17+
Building aggregate site into: $(outpath)
18+
"""
719

20+
@info "Building Documenter site for ITensorDocsNext"
821
include("make_index.jl")
9-
10-
makedocs(;
22+
Documenter.makedocs(;
23+
sitename="ITensor ecosystem docs",
1124
modules=[ITensorDocsNext],
12-
authors="ITensor developers <support@itensor.org> and contributors",
13-
sitename="ITensorDocsNext.jl",
14-
format=Documenter.HTML(;
15-
canonical="https://ITensor.github.io/ITensorDocsNext.jl",
16-
edit_link="main",
17-
assets=String[],
18-
),
19-
pages=["Home" => "index.md", "Reference" => "reference.md"],
25+
warnonly=true,
26+
pages=["index.md"],
2027
)
2128

22-
deploydocs(;
23-
repo="github.com/ITensor/ITensorDocsNext.jl", devbranch="main", push_preview=true
29+
@info "Building aggregate ITensorDocsNext site"
30+
function itensor_multidocref(pkgname::String; clonedir::String=clonedir)
31+
return MultiDocumenter.MultiDocRef(;
32+
upstream=joinpath(clonedir, pkgname),
33+
path=pkgname,
34+
name=pkgname,
35+
giturl="https://github.com/ITensor/$(pkgname).jl.git",
36+
)
37+
end
38+
docs = [
39+
# We also add ITensorDocsNext's own generated pages
40+
MultiDocumenter.MultiDocRef(;
41+
upstream=joinpath(@__DIR__, "build"),
42+
path="Overview",
43+
name="Home",
44+
fix_canonical_url=false,
45+
),
46+
MultiDocumenter.MegaDropdownNav(
47+
"Array Libraries",
48+
itensor_multidocref.([
49+
"ITensorBase",
50+
"NamedDimsArrays",
51+
"BlockSparseArrays",
52+
"SparseArraysBase",
53+
"DiagonalArrays",
54+
"TensorAlgebra",
55+
]),
56+
),
57+
MultiDocumenter.MegaDropdownNav(
58+
"Group Symmetric Arrays", itensor_multidocref.(["GradedUnitRanges", "SymmetrySectors"])
59+
),
60+
MultiDocumenter.MegaDropdownNav(
61+
"Developer Tools",
62+
itensor_multidocref.(["DerivableInterfaces", "TypeParameterAccessors", "MapBroadcast"]),
63+
),
64+
]
65+
66+
MultiDocumenter.make(
67+
outpath,
68+
docs;
69+
search_engine=MultiDocumenter.SearchConfig(;
70+
index_versions=["stable"], engine=MultiDocumenter.FlexSearch
71+
),
72+
rootpath="/ITensorDocsNext/",
73+
canonical_domain="https://itensor.github.io/",
74+
sitemap=true,
2475
)
76+
77+
if "deploy" in ARGS
78+
@warn "Deploying to GitHub" ARGS
79+
gitroot = normpath(joinpath(@__DIR__, ".."))
80+
run(`git pull`)
81+
outbranch = "gh-pages"
82+
has_outbranch = true
83+
if !success(`git checkout $outbranch`)
84+
has_outbranch = false
85+
if !success(`git switch --orphan $outbranch`)
86+
@error "Cannot create new orphaned branch $outbranch."
87+
exit(1)
88+
end
89+
end
90+
for file in readdir(gitroot; join=true)
91+
endswith(file, ".git") && continue
92+
rm(file; force=true, recursive=true)
93+
end
94+
for file in readdir(outpath)
95+
cp(joinpath(outpath, file), joinpath(gitroot, file))
96+
end
97+
run(`git add .`)
98+
if success(`git commit -m 'Aggregate documentation'`)
99+
@info "Pushing updated documentation."
100+
if has_outbranch
101+
run(`git push`)
102+
else
103+
run(`git push -u origin $outbranch`)
104+
end
105+
run(`git checkout main`)
106+
else
107+
@info "No changes to aggregated documentation."
108+
end
109+
else
110+
@info "Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS
111+
cp(outpath, joinpath(@__DIR__, "out"); force=true)
112+
end

examples/README.jl

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,8 @@
1-
# # ITensorDocsNext.jl
1+
# # Documentation for in-progress rewrite of the ITensor ecosystem
22
#
3-
# [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/ITensorDocsNext.jl/stable/)
4-
# [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/ITensorDocsNext.jl/dev/)
5-
# [![Build Status](https://github.com/ITensor/ITensorDocsNext.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/ITensorDocsNext.jl/actions/workflows/Tests.yml?query=branch%3Amain)
6-
# [![Coverage](https://codecov.io/gh/ITensor/ITensorDocsNext.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/ITensorDocsNext.jl)
7-
# [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
8-
# [![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
93

104
# ## Support
115
#
126
# {CCQ_LOGO}
137
#
14-
# ITensorDocsNext.jl is supported by the Flatiron Institute, a division of the Simons Foundation.
15-
16-
# ## Installation instructions
17-
18-
# This package resides in the `ITensor/ITensorRegistry` local registry.
19-
# In order to install, simply add that registry through your package manager.
20-
# This step is only required once.
21-
#=
22-
```julia
23-
julia> using Pkg: Pkg
24-
25-
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
26-
```
27-
=#
28-
# or:
29-
#=
30-
```julia
31-
julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git")
32-
```
33-
=#
34-
# if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.
35-
36-
# Then, the package can be added as usual through the package manager:
37-
38-
#=
39-
```julia
40-
julia> Pkg.add("ITensorDocsNext")
41-
```
42-
=#
43-
44-
# ## Examples
45-
46-
using ITensorDocsNext: ITensorDocsNext
47-
# Examples go here.
8+
# ITensor is supported by the Flatiron Institute, a division of the Simons Foundation.

0 commit comments

Comments
 (0)