Skip to content

Commit a6847dc

Browse files
authored
move docs build scripts to master (#5140)
1 parent 67ab64b commit a6847dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+6627
-21
lines changed

.github/workflows/docs.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ on:
77
tags: '*'
88
release:
99
types: [published]
10+
pull_request:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
14+
cancel-in-progress: true
1015

1116
jobs:
12-
Build_docs:
17+
build:
18+
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'documentation') }}
19+
permissions:
20+
actions: write
21+
contents: write
22+
pull-requests: read
23+
statuses: write
1324
runs-on: ubuntu-latest
25+
env:
26+
PYTHON: ""
27+
DOCUMENTER_KEY: ${{secrets.DOCUMENTER_KEY}}
28+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
1429
steps:
1530
- uses: actions/checkout@v4
16-
with:
17-
repository: JuliaPlots/PlotDocs.jl
1831
- uses: julia-actions/setup-julia@latest
19-
- name: Cache artifacts
20-
uses: actions/cache@v4
21-
env:
22-
cache-name: cache-artifacts
23-
with:
24-
path: ~/.julia/artifacts
25-
key: ${{runner.os}}-test-${{env.cache-name}}-${{hashFiles('**/Project.toml')}}
26-
restore-keys: |
27-
${{runner.os}}-test-${{env.cache-name}}-
28-
${{runner.os}}-test-
29-
${{runner.os}}-
30-
- name: Build documentation
31-
env:
32-
PYTHON: ""
33-
DOCUMENTER_KEY: ${{secrets.DOCUMENTER_KEY}}
34-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
35-
run: bash docs/ci_build.sh
32+
- uses: julia-actions/cache@v2
33+
- run: bash -c '. ci/build-docs.sh; install_ubuntu_deps'
34+
- run: bash -c '. ci/build-docs.sh; install_and_precompile_julia_deps'
35+
- run: bash -c '. ci/build-docs.sh; build_documenter_docs'

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
*.jl.cov
22
*.jl.*.cov
33
*.jl.mem
4+
45
.DS_Store
56
examples/.ipynb_checkpoints/*
67
examples/meetup/.ipynb_checkpoints/*
8+
79
deps/plotly-*
810
deps/build.log
911
deps/deps.jl
1012
Manifest.toml
13+
1114
dev/
1215
test/tmpplotsave.hdf5
1316
/.benchmarkci
1417
/benchmark/*.json
1518
.vscode/
16-
.CondaPkg/
19+
.CondaPkg/
20+
21+
# docs
22+
**/generated/
23+
docs/build*/
24+
docs/work*/

ci/build-docs.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
key_unset=false
5+
if [ -z "$DOCUMENTER_KEY" ]; then
6+
echo '`DOCUMENTER_KEY` is missing'
7+
key_unset=true
8+
fi
9+
10+
tok_unset=false
11+
if [ -z "$GITHUB_TOKEN" ]; then
12+
echo '`GITHUB_TOKEN` is missing'
13+
tok_unset=true
14+
fi
15+
16+
if $key_unset && $tok_unset; then
17+
echo 'either `GITHUB_TOKEN` or `DOCUMENTER_KEY` must be set for `Documenter` !'
18+
exit 1
19+
fi
20+
21+
if true; then
22+
export JULIA_DEBUG='Documenter,Literate,DemoCards'
23+
export DOCUMENTER_DEBUG=true # Democards.jl
24+
fi
25+
26+
export LD_PRELOAD=$(g++ --print-file-name=libstdc++.so)
27+
export GKSwstype=nul # Plots.jl/issues/3664
28+
export MPLBACKEND=agg
29+
export COLORTERM=truecolor # UnicodePlots.jl
30+
export PLOTDOCS_ANSICOLOR=true
31+
export JULIA_CONDAPKG_BACKEND=MicroMamba
32+
33+
julia_project() {
34+
xvfb-run -a julia --color=yes --project=docs "$@"
35+
}
36+
37+
install_ubuntu_deps() {
38+
echo '== install system dependencies =='
39+
sudo apt -y update
40+
sudo apt -y install \
41+
texlive-{latex-{base,extra},binaries,pictures,luatex} \
42+
ttf-mscorefonts-installer \
43+
poppler-utils \
44+
ghostscript-x \
45+
qtbase5-dev \
46+
pdf2svg \
47+
gnuplot \
48+
g++
49+
50+
echo '== install fonts =='
51+
mkdir -p ~/.fonts
52+
repo="https://github.com/cormullion/juliamono"
53+
ver="$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' "$repo.git" | tail -n 1 | awk '{ print $2 }' | sed 's,refs/tags/,,')"
54+
url="$repo/releases/download/$ver/JuliaMono-ttf.tar.gz"
55+
echo "downloading & extract url=$url"
56+
wget -q "$url" -O - | tar -xz -C ~/.fonts
57+
sudo fc-cache -vr
58+
fc-list | grep 'JuliaMono'
59+
}
60+
61+
install_and_precompile_julia_deps() {
62+
echo "== install julia dependencies =="
63+
JULIA_PKG_PRECOMPILE_AUTO=0 julia_project ci/matplotlib.jl
64+
echo '== precompile docs dependencies =='
65+
julia_project docs/make.jl none
66+
}
67+
68+
build_documenter_docs() {
69+
echo "== build documentation for $GITHUB_REPOSITORY@$GITHUB_REF, triggered by $GITHUB_ACTOR on $GITHUB_EVENT_NAME =="
70+
# export PLOTDOCS_PACKAGES='UnicodePlots'
71+
# export PLOTDOCS_PUSH_PREVIEW=true
72+
# export PLOTDOCS_EXAMPLES=1
73+
julia_project docs/make.jl
74+
}

ci/matplotlib.jl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Pkg
2+
Pkg.add("CondaPkg")
3+
4+
using CondaPkg
5+
CondaPkg.resolve()
6+
7+
# table adapted from `4. Symbol versioning on the libstdc++.so binary` in
8+
# gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
9+
# see also github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/config/abi/pre/gnu.ver
10+
_compatible_libstdcxx_ng_versions = [
11+
(v"3.4.34", (">=15.1", "<16.1")), # NOTE: hypothetical upper bound
12+
(v"3.4.33", (">=14.1", "<15.1")),
13+
(v"3.4.32", (">=13.2", "<14.1")),
14+
(v"3.4.31", (">=13.1", "<13.2")),
15+
(v"3.4.30", (">=12.1", "<13.1")),
16+
(v"3.4.29", (">=11.1", "<12.1")),
17+
(v"3.4.28", (">=9.3", "<11.1")),
18+
(v"3.4.27", (">=9.2", "<9.3")),
19+
(v"3.4.26", (">=9.1", "<9.2")),
20+
(v"3.4.25", (">=8.1", "<9.1")),
21+
(v"3.4.24", (">=7.2", "<8.1")),
22+
(v"3.4.23", (">=7.1", "<7.2")),
23+
(v"3.4.22", (">=6.1", "<7.1")),
24+
(v"3.4.21", (">=5.1", "<6.1")),
25+
(v"3.4.20", (">=4.9", "<5.1")),
26+
(v"3.4.19", (">=4.8.3", "<4.9")),
27+
]
28+
libgcc = if Sys.islinux()
29+
# see discourse.julialang.org/t/glibcxx-version-not-found/82209/8
30+
# julia 1.8.3 is built with libstdc++.so.6.0.29, so we must restrict to this version (gcc 11.3.0, not gcc 12.2.0)
31+
versions = Dict(_compatible_libstdcxx_ng_versions)
32+
lo, hi = extrema(keys(versions))
33+
_, ub = versions[Base.BinaryPlatforms.detect_libstdcxx_version(Int(hi.patch))]
34+
specs = ">=$(VersionNumber(lo.major, lo.minor)),$ub"
35+
("libgcc-ng$specs", "libstdcxx-ng$specs")
36+
else
37+
()
38+
end
39+
40+
CondaPkg.PkgREPL.add([libgcc..., "matplotlib>=3.4"]) # "openssl>=3.4"
41+
CondaPkg.status()

docs/Project.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
[deps]
2+
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
3+
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
4+
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
5+
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
6+
DemoCards = "311a05b2-6137-4a5a-b473-18580a3d38b5"
7+
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
8+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
9+
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
10+
FreeType = "b38be410-82b0-50bf-ab77-7b57e271db43"
11+
Gaston = "4b11ee91-296f-5714-9832-002c20994614"
12+
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
13+
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
14+
GraphRecipes = "bd48cda9-67a9-57be-86fa-5b3c104eda73"
15+
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
16+
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
17+
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
18+
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
19+
InspectDR = "d0351b0e-4b05-5898-87b3-e2a8edfddd1d"
20+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
21+
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
22+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
23+
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
24+
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
25+
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
26+
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
27+
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
28+
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
29+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
30+
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
31+
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
32+
PlotlyKaleido = "f2990250-8cf9-495f-b13a-cce12b45703c"
33+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
34+
PlotThemes = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
35+
PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9"
36+
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
37+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
38+
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
39+
RecipesPipeline = "01d81517-befc-4cb6-b9ec-a95719d0359c"
40+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
41+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
42+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
43+
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
44+
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
45+
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
46+
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
47+
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
48+
49+
[compat]
50+
DataFrames = "1"
51+
Dates = "1"
52+
Documenter = "1"
53+
FileIO = "1"
54+
FreeType = "4"
55+
Gaston = "1"
56+
Glob = "1"
57+
LaTeXStrings = "1"
58+
Literate = "2"
59+
LinearAlgebra = "1"
60+
OffsetArrays = "1"
61+
OrderedCollections = "1"
62+
Pkg = "1"
63+
Plots = "1"
64+
PlotThemes = "3"
65+
PGFPlotsX = "1"
66+
PythonPlot = "1"
67+
SparseArrays = "1"
68+
StableRNGs = "1"
69+
StaticArrays = "1"
70+
TestImages = "1"
71+
UnicodePlots = "3"
72+
Unitful = "1"
73+
74+
[sources]
75+
Plots = {path = ".."}
76+
RecipesBase = {path = "../RecipesBase"}
77+
RecipesPipeline = {path = "../RecipesPipeline"}

docs/gallery/gaston/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"theme": "bulmagrid",
3+
"properties":{
4+
"notebook": "false"
5+
}
6+
}

docs/gallery/gaston/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Gaston
2+
3+
To switch to the `Gaston` backend, you can use:
4+
5+
```julia
6+
using Plots
7+
gaston()
8+
```
9+
10+
The demos are generated from `Plots._examples`. Empty demos are features that this backend does not support.
11+
12+
{{{democards}}}

docs/gallery/gr/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"theme": "bulmagrid",
3+
"properties":{
4+
"notebook": "false"
5+
}
6+
}

docs/gallery/gr/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# GR
2+
3+
`GR` is the default backend for `Plots`. To explicitly specify the `GR` backend, you can use:
4+
5+
```julia
6+
using Plots
7+
gr()
8+
```
9+
10+
The demos are generated from `Plots._examples`. Empty demos are features that this backend does not support.
11+
12+
{{{democards}}}

docs/gallery/inspectdr/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"theme": "bulmagrid",
3+
"properties":{
4+
"notebook": "false"
5+
}
6+
}

0 commit comments

Comments
 (0)