Skip to content

Use MultiDocumenter.jl #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Apr 12, 2025
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
eb24cc1
Removing hosting of other packages' docs
abhro Dec 26, 2024
7459aed
Add docs site link for AstroAngles.jl
abhro Dec 26, 2024
ef85786
Update assets link
abhro Mar 31, 2025
e1ffaca
Add GitHub token secret to docs CI
abhro Mar 31, 2025
d03a0f4
Merge remote-tracking branch 'origin/rm-hosted-copies' into source
abhro Apr 1, 2025
2c6cdd7
first pass at multidocs
icweaver Apr 4, 2025
c627f09
src different than dst
icweaver Apr 4, 2025
4e402bd
trying deploy
icweaver Apr 4, 2025
0f6b853
split workflow steps
icweaver Apr 4, 2025
c7f4072
instantiate
icweaver Apr 4, 2025
777694d
going back to docdeploy action
icweaver Apr 4, 2025
d90ac6f
no orphans
icweaver Apr 4, 2025
2efcffe
try deploydocs directly
icweaver Apr 4, 2025
89b6c34
update branches and switch deploy method
icweaver Apr 4, 2025
b6c6915
back to deploydocs
icweaver Apr 4, 2025
44338f2
back to manual deploy
icweaver Apr 4, 2025
430b814
typo?
icweaver Apr 4, 2025
39fd960
whitespace
icweaver Apr 4, 2025
d562e7b
specify branch
icweaver Apr 4, 2025
07daec8
cleanup
icweaver Apr 4, 2025
8a9eefc
Use shell option for workflow yml
abhro Apr 5, 2025
fefd672
Use julia color option for docs/make.jl workflow step
abhro Apr 5, 2025
24f81f3
Add favicon to Documenter.HTML() assets
abhro Apr 5, 2025
7043e22
Add versions keyword to deploydocs()
abhro Apr 5, 2025
5be9729
Trying updated search path
icweaver Apr 5, 2025
98cbe98
trying temporary PR preview root for universal search functionality
icweaver Apr 5, 2025
f197c0e
fix search path
icweaver Apr 5, 2025
0e830bd
enabled sitemap again
icweaver Apr 5, 2025
fcd3307
typo
icweaver Apr 5, 2025
18fc0d7
Change devbranch in deploydocs back to source
abhro Apr 12, 2025
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
13 changes: 11 additions & 2 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@ on:
- cron: '15 2 * * *' # 2:15 AM UTC every day
jobs:
docs:
name: Documentation
name: MultiDocumentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-docdeploy@v1
- name: Install dependencies
shell: julia --color=yes --project=docs {0}
run: |
using Pkg
Pkg.instantiate()
- name: Aggregate and deploy
run: |
git config user.name github-actions
git config user.email [email protected]
julia --color=yes --project=docs docs/make.jl --deploy
env:
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
MultiDocumenter = "87ed4bf0-c935-4a67-83c3-2a03bee4197c"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[compat]
Expand Down
292 changes: 275 additions & 17 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
using LibGit2, Pkg, TOML, UUIDs
using MultiDocumenter, Documenter
using LibGit2, Pkg, TOML, UUIDs, Downloads

# This make file compiles the documentation for the JuliaAstro website.
# It consists of the usual documeter structure, but also follows the approach
# It consists of the usual documenter structure, but also follows the approach
# of the SciML docs page https://github.com/SciML/SciMLDocs/blob/main/docs/make.jl
# by generating nested documentation for packages under the JuliaAstro organization.
# That way, docs for all packages are browesable and searchable in one place!
# That way, docs for all packages are browsable and searchable in one place!

include("install.jl")
clonedir = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "clones")
outpath = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "build")

for depe in to_use
eval(quote
using $depe
push!(allmods, $depe)
end)
end
@info """
Cloning packages into: $(clonedir)
Building aggregate site into: $(outpath)
"""

# We wait to import Documenter in case one of the packages requires
# an older version. If that was the case, it's version may have changed
# after the above for-loop
using Documenter
@info "Building MultiDocumenter site for JuliaAstro"

include("pages.jl")
mathengine = MathJax3(Dict(
:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]),
:tex => Dict(
Expand All @@ -31,25 +29,285 @@ mathengine = MathJax3(Dict(
makedocs(
sitename="JuliaAstro",
authors = "Julia Astro Contributors",
modules=identity.(allmods),
clean=true,
doctest=false,
format=Documenter.HTML(
mathengine=mathengine,
prettyurls = get(ENV, "CI", "false") == "true",
canonical = "https://juliaastro.github.io/",
canonical = "https://juliaastro.org/",
assets = String[
"assets/styles.css",
"assets/favicon.ico",
],
),
pages=fullpages,
warnonly=[:missing_docs],
)

@info "Building aggregate JuliaAstro site"
docs = [
# We also add JuliaAstro's own generated pages
MultiDocumenter.MultiDocRef(
upstream = joinpath(@__DIR__, "build"),
path = "docs",
name = "JuliaAstro",
fix_canonical_url = false,
),
MultiDocumenter.DropdownNav(
"Time, Coordinates, & Units",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "AstroAngles"),
path = "AstroAngles",
name = "AstroAngles",
giturl = "https://github.com/JuliaAstro/AstroAngles.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "AstroTime"),
path = "AstroTime",
name = "AstroTime",
giturl = "https://github.com/JuliaAstro/AstroTime.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "ERFA"),
path = "ERFA",
name = "ERFA",
giturl = "https://github.com/JuliaAstro/ERFA.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "SkyCoords"),
path = "SkyCoords",
name = "SkyCoords",
giturl = "https://github.com/JuliaAstro/SkyCoords.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "UnitfulAstro"),
path = "UnitfulAstro",
name = "UnitfulAstro",
giturl = "https://github.com/JuliaAstro/UnitfulAstro.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "WCS"),
path = "WCS",
name = "WCS",
giturl = "https://github.com/JuliaAstro/WCS.jl.git",
),
]
),
MultiDocumenter.DropdownNav(
"Images",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "AstroImages"),
path = "AstroImages",
name = "AstroImages",
giturl = "https://github.com/JuliaAstro/AstroImages.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "SAOImagesDS9"),
path = "SAOImagesDS9",
name = "SAOImagesDS9",
giturl = "https://github.com/JuliaAstro/SAOImageDS9.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Photometry"),
path = "Photometry",
name = "Photometry",
giturl = "https://github.com/juliaastro/Photometry.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "PSFModels"),
path = "PSFModels",
name = "PSFModels",
giturl = "https://github.com/juliaastro/PSFModels.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "LACosmic"),
path = "LACosmic",
name = "LACosmic",
giturl = "https://github.com/juliaastro/LACosmic.jl.git",
),
]
),
MultiDocumenter.DropdownNav(
"Data I/O",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "AstroImages"),
path = "AstroImages",
name = "AstroImages",
giturl = "https://github.com/JuliaAstro/AstroImages.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "FITSIO"),
path = "FITSIO",
name = "FITSIO",
giturl = "https://github.com/JuliaAstro/FITSIO.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "CFITSIO"),
path = "CFITSIO",
name = "CFITSIO",
giturl = "https://github.com/JuliaAstro/CFITSIO.jl.git",
),
MultiDocumenter.Link(
"mweastwood/CasaCore",
"http://mweastwood.info/CasaCore.jl/stable/",
),
MultiDocumenter.Link(
"emmt/OIFITS",
"https://github.com/emmt/OIFITS.jl",
),
MultiDocumenter.Link(
"aplavin/VLBIData",
"https://github.com/JuliaAPlavin/VLBIData.jl",
),
MultiDocumenter.Link(
"aplavin/Difmap",
"https://github.com/JuliaAPlavin/Difmap.jl",
),
]
),
MultiDocumenter.DropdownNav(
"Cosmology",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Cosmology"),
path = "Cosmology",
name = "Cosmology",
giturl = "https://github.com/JuliaAstro/Cosmology.jl.git",
),
]
),
MultiDocumenter.DropdownNav(
"Orbits & Ephemerides",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Transits"),
path = "Transits",
name = "Transits",
giturl = "https://github.com/JuliaAstro/Transits.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "sefffal/PlanetOrbits"),
path = "sefffal/PlanetOrbits",
name = "sefffal/PlanetOrbits",
giturl = "https://github.com/sefffal/PlanetOrbits.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "EarthOrientation"),
path = "EarthOrientation",
name = "EarthOrientation",
giturl = "https://github.com/JuliaAstro/EarthOrientation.jl.git",
),
MultiDocumenter.Link(
"JPLEphemeris",
"https://github.com/JuliaAstro/JPLEphemeris.jl",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "AstroLib"),
path = "AstroLib",
name = "AstroLib",
giturl = "https://github.com/JuliaAstro/AstroLib.jl.git",
),
]
),
MultiDocumenter.DropdownNav(
"Numerical Utilities",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "BoxLeastSquares"),
path = "BoxLeastSquares",
name = "BoxLeastSquares",
giturl = "https://github.com/JuliaAstro/BoxLeastSquares.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "LombScargle"),
path = "LombScargle",
name = "LombScargle",
giturl = "https://github.com/JuliaAstro/LombScargle.jl.git",
),
]
),
MultiDocumenter.DropdownNav(
"Statistics",
[
MultiDocumenter.Link(
"sefffal/PairPlots",
"https://sefffal.github.io/PairPlots.jl/dev",
),
]
),
]
Comment on lines +48 to +241
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit is all manual and gross for now just to stand things up, and can be replaced by something like #44 if we end up wanting to go the "single source of truth" route discussed there


MultiDocumenter.make(
outpath,
docs;
assets_dir = "docs/src/assets",
search_engine = MultiDocumenter.SearchConfig(
index_versions = ["stable"],
engine = MultiDocumenter.FlexSearch
),
rootpath = "/previews/PR43/",
canonical_domain = "https://JuliaAstro.org/",
brand_image = MultiDocumenter.BrandImage(".", joinpath("assets", "logo.svg")),
sitemap = true,
)
@info "Aggregate build done"

# Download logo
assets_dir = joinpath(outpath, "assets")
mkpath(assets_dir)
Downloads.download(
"https://raw.githubusercontent.com/JuliaAstro/JuliaAstro.github.io/refs/heads/source/docs/src/assets/logo.svg",
joinpath(assets_dir, "logo.svg");
verbose = true,
)
@info "Final build done"

@info "Deployng docs"
#if "--deploy" in ARGS
# @warn "Deploying to GitHub" ARGS
# gitroot = normpath(joinpath(@__DIR__, ".."))
# run(`git pull`)
# outbranch = "master"
# has_outbranch = true
# if !success(`git checkout $outbranch`)
# has_outbranch = false
# if !success(`git switch --orphan $outbranch`)
# @error "Cannot create new orphaned branch $outbranch."
# exit(1)
# end
# end
# for file in readdir(gitroot; join = true)
# (endswith(file, ".git") || (basename(file) == "CNAME")) && continue
# rm(file; force = true, recursive = true)
# end
# for file in readdir(outpath)
# cp(joinpath(outpath, file), joinpath(gitroot, file))
# end
# run(`git add .`)
# if success(`git commit -m 'Aggregate documentation'`)
# @info "Pushing updated documentation."
# if has_outbranch
# run(`git push`)
# else
# run(`git push -u origin $outbranch`)
# end
# run(`git checkout source`)
# else
# @info "No changes to aggregated documentation."
# end
#else
# @info "Skipping deployment, 'deploy' not passed. Generated files in docs/$(outpath)." ARGS
# cp(outpath, joinpath(@__DIR__, "build"), force = true)
#end

deploydocs(;
repo = "github.com/JuliaAstro/JuliaAstro.github.io",
push_preview = true,
branch = "master",
devbranch = "source"
devbranch = "multidocumenter",
Copy link
Member

@abhro abhro Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed back to devbranch = "source" before merging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You read my mind. Wasn't sure how that would play with PR doc previews, but totally happy to switch it back if it looks good to you!

versions = nothing,
)
@info "Deploy complete"
Loading