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
111 changes: 7 additions & 104 deletions .github/workflows/Documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:
pull_request:

jobs:
benders-docs:
name: Docs (PlasmoBenders)
build:
permissions:
actions: write
contents: write
Expand All @@ -20,108 +19,12 @@ jobs:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1.10'
version: '1.6'
- uses: julia-actions/cache@v1
- name: Install dependencies (PlasmoBenders)
env:
DOC_PKG: PlasmoBenders
- name: Install dependencies
run: julia --project=docs/ docs/install.jl
- name: Build and deploy (PlasmoBenders)
env:
DOC_PKG: PlasmoBenders
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
run: julia --project=docs/ docs/make.jl

schwarz-docs:
name: Docs (PlasmoSchwarz)
needs: benders-docs
permissions:
actions: write
contents: write
pull-requests: read
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1.10'
- uses: julia-actions/cache@v1
- name: Install dependencies (PlasmoSchwarz)
env:
DOC_PKG: PlasmoSchwarz
run: julia --project=docs/ docs/install.jl
- name: Build and deploy (PlasmoSchwarz)
env:
DOC_PKG: PlasmoSchwarz
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
run: julia --project=docs/ docs/make.jl

docs-index:
name: Docs (index)
needs: [benders-docs, schwarz-docs]
if: github.event_name == 'push' || github.event_name == 'pull_request' # TODO: remove PR after testing
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 1
- name: Create dev index with links
run: |
mkdir -p dev
cat > dev/index.html <<'EOF'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PlasmoAlgorithms.jl Docs</title>
<style>
body { font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; margin: 2rem; }
h1 { margin-bottom: 0.5rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.card { border: 1px solid #e0e0e0; border-radius: 8px; padding: 1rem; }
a { text-decoration: none; color: #0059b3; font-weight: 600; }
small { color: #666; }
</style>
</head>
<body>
<h1>PlasmoAlgorithms.jl documentation</h1>
<p>Select a sub-package:</p>
<div class="cards">
<div class="card">
<a href="../benders/">PlasmoBenders</a>
<div><small>Decomposition via Benders</small></div>
</div>
<div class="card">
<a href="../schwarz/">PlasmoSchwarz</a>
<div><small>Domain decomposition (Schwarz)</small></div>
</div>
</div>
</body>
</html>
EOF
- name: Commit and push index
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add dev/index.html
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Update docs dev index with links to benders and schwarz"
# Only push on push events (not PRs from forks which lack write perms)
if [ "${{ github.event_name }}" = "push" ]; then
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git gh-pages
else
echo "Skipping push on PR (testing mode)"
fi
fi
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
run: julia --project=docs/ docs/make.jl
14 changes: 2 additions & 12 deletions docs/install.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ using Pkg

PA_DIR = pwd()

doc_pkg = get(ENV, "DOC_PKG", nothing)

if doc_pkg === nothing
# Fallback: develop both (may conflict if dependencies are incompatible)
@info "DOC_PKG not set; developing both PlasmoBenders and PlasmoSchwarz"
Pkg.develop(path=joinpath(PA_DIR, "lib", "PlasmoBenders"))
Pkg.develop(path=joinpath(PA_DIR, "lib", "PlasmoSchwarz"))
else
@info "Developing only $(doc_pkg) for docs build"
Pkg.develop(path=joinpath(PA_DIR, "lib", doc_pkg))
end

Pkg.develop(path=joinpath(PA_DIR, "lib", "PlasmoBenders"))
Pkg.develop(path=joinpath(PA_DIR, "lib", "PlasmoSchwarz"))
Pkg.instantiate()
135 changes: 29 additions & 106 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,117 +2,40 @@
# This Source Code Form is subject to the terms of the MIT License
# This source code is adapted from that of Plasmo.jl which can be found at https://github.com/plasmo-dev/Plasmo.jl/blob/main/docs/make.jl

using Documenter, Plasmo, Suppressor, Graphs
using Base: walkdir

doc_pkg = get(ENV, "DOC_PKG", "PlasmoBenders") # default to PlasmoBenders

if doc_pkg == "PlasmoBenders"
@info "Building docs for PlasmoBenders"
using PlasmoBenders
DocMeta.setdocmeta!(PlasmoBenders, :DocTestSetup, :(using PlasmoBenders); recursive=true)
elseif doc_pkg == "PlasmoSchwarz"
@info "Building docs for PlasmoSchwarz"
using PlasmoSchwarz
DocMeta.setdocmeta!(PlasmoSchwarz, :DocTestSetup, :(using PlasmoSchwarz); recursive=true)
else
error("Unsupported DOC_PKG=$(doc_pkg). Expected PlasmoBenders or PlasmoSchwarz.")
end
using Documenter, Plasmo, Suppressor, Graphs, PlasmoBenders, PlasmoSchwarz

DocMeta.setdocmeta!(Plasmo, :DocTestSetup, :(using Plasmo); recursive=true)
DocMeta.setdocmeta!(Plasmo, :DocTestSetup, :(using Plasmo); recursive=true)

pages_benders = [
"Introduction" => "index.md",
"PlasmoBenders.jl" => [
"Introduction" => "PlasmoBenders/introduction.md",
"Algorithm" => "PlasmoBenders/algorithm.md",
"Quickstart" => "PlasmoBenders/quickstart.md",
"Solver Options" => "PlasmoBenders/solver.md",
"Exploiting Graph Structure" => "PlasmoBenders/graph_structure.md",
"API Documentation" => "PlasmoBenders/api_docs.md",
"Tutorials" => [
"Storage Operation" => "PlasmoBenders/storage_tutorial.md",
"Equipment Sizing" => "PlasmoBenders/sizing_tutorial.md"
],
],
]

pages_schwarz = [
"Introduction" => "index.md",
"PlasmoSchwarz.jl" => [
"Introduction" => "PlasmoSchwarz/introduction.md",
"Quickstart" => "PlasmoSchwarz/quickstart.md",
"Algorithm" => "PlasmoSchwarz/algorithm.md",
"API Documentation" => "PlasmoSchwarz/api_docs.md",
]
]
DocMeta.setdocmeta!(PlasmoBenders, :DocTestSetup, :(using PlasmoBenders); recursive=true)
DocMeta.setdocmeta!(PlasmoSchwarz, :DocTestSetup, :(using PlasmoSchwarz); recursive=true)

modules_sel = doc_pkg == "PlasmoBenders" ? [PlasmoBenders] : [PlasmoSchwarz]
pages_sel = doc_pkg == "PlasmoBenders" ? pages_benders : pages_schwarz

# Build in a filtered temporary source directory to avoid processing pages
# of the other package when building docs for one package.
src_root = joinpath(@__DIR__, "src")
tmp_src = mktempdir()

# Always include index.md
mkpath(tmp_src)
cp(joinpath(src_root, "index.md"), joinpath(tmp_src, "index.md"); force=true)

# Include shared figures folder so relative image links work
fig_src = joinpath(src_root, "figures")
fig_dst = joinpath(tmp_src, "figures")
if isdir(fig_src)
mkpath(fig_dst)
for (root, dirs, files) in walkdir(fig_src)
rel = replace(root, fig_src => "")
target_root = joinpath(fig_dst, rel)
mkpath(target_root)
for f in files
cp(joinpath(root, f), joinpath(target_root, f); force=true)
end
end
end

if doc_pkg == "PlasmoBenders"
# Copy only PlasmoBenders pages directory
src_dir = joinpath(src_root, "PlasmoBenders")
dest_dir = joinpath(tmp_src, "PlasmoBenders")
mkpath(dest_dir)
for (root, dirs, files) in walkdir(src_dir)
rel = replace(root, src_dir => "")
target_root = joinpath(dest_dir, rel)
mkpath(target_root)
for f in files
cp(joinpath(root, f), joinpath(target_root, f); force=true)
end
end
else
# Copy only PlasmoSchwarz pages directory
src_dir = joinpath(src_root, "PlasmoSchwarz")
dest_dir = joinpath(tmp_src, "PlasmoSchwarz")
mkpath(dest_dir)
for (root, dirs, files) in walkdir(src_dir)
rel = replace(root, src_dir => "")
target_root = joinpath(dest_dir, rel)
mkpath(target_root)
for f in files
cp(joinpath(root, f), joinpath(target_root, f); force=true)
end
end
end

makedocs(;
sitename="PlasmoAlgorithms.jl - $(doc_pkg)",
modules=modules_sel,
makedocs(;
sitename="PlasmoAlgorithms.jl",
modules=[PlasmoBenders],
doctest=true,
checkdocs=:export,
source=tmp_src,
format=Documenter.HTML(; prettyurls=get(ENV, "CI", nothing) == "true", edit_link = nothing),
format=Documenter.HTML(; prettyurls=get(ENV, "CI", nothing) == "true"),
authors="Jordan Jalving and David Cole",
pages=pages_sel,
pages=[
"Introduction" => "index.md",
"PlasmoBenders.jl" => [
"Introduction" => "PlasmoBenders/introduction.md",
"Algorithm" => "PlasmoBenders/algorithm.md",
"Quickstart" => "PlasmoBenders/quickstart.md",
"Solver Options" => "PlasmoBenders/solver.md",
"Exploiting Graph Structure" => "PlasmoBenders/graph_structure.md",
"API Documentation" => "PlasmoBenders/api_docs.md",
"Tutorials" => [
"Storage Operation" => "PlasmoBenders/storage_tutorial.md",
"Equipment Sizing" => "PlasmoBenders/sizing_tutorial.md"
],
],
"PlasmoSchwarz.jl" => [
"Introduction" => "PlasmoSchwarz/introduction.md",
"Quickstart" => "PlasmoSchwarz/quickstart.md",
"Algorithm" => "PlasmoSchwarz/algorithm.md",
"API Documentation" => "PlasmoSchwarz/api_docs.md",
]
],
)

devurl = doc_pkg == "PlasmoBenders" ? "benders" : "schwarz"
deploydocs(; repo="github.com/plasmo-dev/PlasmoAlgorithms.jl.git", devurl=devurl)
deploydocs(; repo="github.com/plasmo-dev/PlasmoAlgorithms.jl.git")
2 changes: 1 addition & 1 deletion lib/PlasmoSchwarz/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DataStructures = "0.18"
JuMP = "1.2"
MathOptInterface = "1.6"
Metis = "1.5"
Plasmo = "^0.6.2"
Plasmo = "0.7"

[extras]
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
Expand Down
Loading