diff --git a/.github/workflows/Documentation.yaml b/.github/workflows/Documentation.yaml index 8a07c9c..f3f48ef 100644 --- a/.github/workflows/Documentation.yaml +++ b/.github/workflows/Documentation.yaml @@ -8,8 +8,7 @@ on: pull_request: jobs: - benders-docs: - name: Docs (PlasmoBenders) + build: permissions: actions: write contents: write @@ -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' - - - - - - PlasmoAlgorithms.jl Docs - - - -

PlasmoAlgorithms.jl documentation

-

Select a sub-package:

-
-
- PlasmoBenders -
Decomposition via Benders
-
-
- PlasmoSchwarz -
Domain decomposition (Schwarz)
-
-
- - - 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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/docs/install.jl b/docs/install.jl index bc33be8..9f63792 100644 --- a/docs/install.jl +++ b/docs/install.jl @@ -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() diff --git a/docs/make.jl b/docs/make.jl index e4adb77..9156a5c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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") diff --git a/lib/PlasmoSchwarz/Project.toml b/lib/PlasmoSchwarz/Project.toml index 2a97429..6acf132 100644 --- a/lib/PlasmoSchwarz/Project.toml +++ b/lib/PlasmoSchwarz/Project.toml @@ -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"