Skip to content

Commit 1a28d56

Browse files
committed
Use a docs environment
This should decrease the time required to build the docs on CI, and follows the "best practices" that e.g., JuliaHub expects.
1 parent faa8cb0 commit 1a28d56

7 files changed

Lines changed: 44 additions & 8 deletions

File tree

.github/workflows/CI.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ jobs:
6060
with:
6161
files: lcov.info
6262
token: ${{ secrets.CODECOV_TOKEN }}
63+
- name: Save Julia depot cache on cancel or failure
64+
id: julia-cache-save
65+
if: cancelled() || failure()
66+
uses: actions/cache/save@v4
67+
with:
68+
path: |
69+
${{ steps.julia-cache.outputs.cache-paths }}
70+
key: ${{ steps.julia-cache.outputs.cache-key }}
6371
docs:
6472
name: Documentation
6573
runs-on: ubuntu-latest
@@ -78,10 +86,10 @@ jobs:
7886
wget https://raw.githubusercontent.com/JuliaQuantumControl/JuliaQuantumControl/master/scripts/installorg.jl
7987
install -m 600 -D /dev/null ~/.ssh/known_hosts
8088
ssh-keyscan -H github.com > ~/.ssh/known_hosts
81-
julia --project=test -e 'include("installorg.jl"); installorg(; github="develop")'
89+
julia --project=docs -e 'include("installorg.jl"); installorg(; github="develop")'
8290
# installing in develop mode enables proper "source" links in subpackage APIs
8391
- name: "Build documentation"
84-
run: julia --project=test docs/make.jl
92+
run: julia --project=docs docs/make.jl
8593
env:
8694
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8795
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
@@ -96,6 +104,14 @@ jobs:
96104
path: |
97105
README.md
98106
./docs.zip
107+
- name: Save Julia depot cache on cancel or failure
108+
id: julia-cache-save
109+
if: cancelled() || failure()
110+
uses: actions/cache/save@v4
111+
with:
112+
path: |
113+
${{ steps.julia-cache.outputs.cache-paths }}
114+
key: ${{ steps.julia-cache.outputs.cache-key }}
99115
codestyle:
100116
name: Codestyle
101117
runs-on: ubuntu-latest

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/Manifest.toml
55
/test/Manifest.toml
66
/docs/Manifest.toml
7-
/docs/Project.toml
87
/docs/build/
98
/gh-pages/
109
/.JuliaFormatter.toml

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ test/Manifest.toml: test/Project.toml ../scripts/installorg.jl
3030
$(JULIA) --project=test ../scripts/installorg.jl
3131
@touch $@
3232

33+
docs/Manifest.toml: docs/Project.toml ../scripts/installorg.jl
34+
$(JULIA) --project=docs ../scripts/installorg.jl
35+
@touch $@
3336

3437
devrepl: ## Start an interactive REPL for testing and building documentation
3538
$(JULIA) --project=test --banner=no --startup-file=yes -i devrepl.jl
3639

3740

38-
docs: test/Manifest.toml ## Build the documentation
39-
$(JULIA) --project=test docs/make.jl
41+
docs: docs/Manifest.toml ## Build the documentation
42+
$(JULIA) --project=docs docs/make.jl
4043
@echo "Done. Consider using 'make devrepl'"
4144

4245
servedocs: test/Manifest.toml ## Build (auto-rebuild) and serve documentation at PORT=8000

docs/Project.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
4+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
5+
GRAPE = "6b52fcaf-80fe-489a-93e9-9f92080510be"
6+
Krotov = "b05dcdc7-62f6-4360-bf2c-0898bba419de"
7+
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
8+
QuantumControl = "8a270532-f23f-47a8-83a9-b33d10cad486"
9+
QuantumPropagators = "7bf12567-5742-4b91-a078-644e72a65fc1"
10+
11+
[sources]
12+
QuantumControl = {path = "/Users/goerz/Documents/Programming/JuliaQuantumControl/QuantumControl.jl/docs/.."}
13+
14+
[compat]
15+
Documenter = "1.4"
16+
julia = "1.11"

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Pkg
2+
Pkg.develop(path=joinpath(@__DIR__, ".."))
23

34
using Documenter
45
using QuantumPropagators
@@ -128,5 +129,4 @@ makedocs(;
128129
)
129130

130131
println("Finished makedocs")
131-
132-
deploydocs(; repo="github.com/JuliaQuantumControl/QuantumControl.jl")
132+
deploydocs(; repo="github.com/JuliaQuantumControl/QuantumControl.jl", push_preview=true)

test/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
4848
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
4949
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
5050

51+
[sources]
52+
QuantumControl = {path = "/Users/goerz/Documents/Programming/JuliaQuantumControl/QuantumControl.jl/docs/.."}
53+
5154
[compat]
5255
Documenter = "1.4"
5356
julia = "1.9"

test/clean.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function clean(; distclean=false, _exit=true)
3838
for folder in ["", "docs", "test"]
3939
_push!(DISTCLEAN, joinpath(joinpath(ROOT, folder), "Manifest.toml"))
4040
end
41-
_push!(DISTCLEAN, joinpath(ROOT, "docs", "Project.toml"))
4241
_push!(DISTCLEAN, joinpath(ROOT, "docs", "src", "examples", ".ipynb_checkpoints"))
4342
_push!(DISTCLEAN, joinpath(ROOT, ".JuliaFormatter.toml"))
4443
###########################################################################

0 commit comments

Comments
 (0)