Skip to content

Commit

Permalink
Merge pull request #377 from JuliaDataCubes/up_workflow
Browse files Browse the repository at this point in the history
Up workflow
  • Loading branch information
lazarusA authored Mar 12, 2024
2 parents fde79c0 + 149dc8a commit 02dc6c5
Show file tree
Hide file tree
Showing 20 changed files with 487 additions and 280 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install documentation dependencies # for GLMakie plots
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- name: Install documentation dependencies
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; pkg"add https://github.com/LuxDL/DocumenterVitepress.jl.git"; pkg"dev ."; pkg"add DimensionalData#main"; Pkg.instantiate(); Pkg.precompile(); Pkg.status()'
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; pkg"dev ."; Pkg.instantiate(); Pkg.precompile(); Pkg.status()'
- name: Instantiate NPM
run: cd docs/; npm i; cd ..
#- name: Creating new mds from src
Expand Down
16 changes: 4 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
Manifest.toml

.DS_Store
*.jl.cov
*.jl.*.cov
*.jl.mem
tmp
generated
build
.vscode
.DS_Store
*.zarr
*.nc
var

docs/docs
docs/site
docs/build
docs/var
deps/build.jl
bonito

*.ipynb_checkpoints
# Ignore the benchmarking results
/benchmark/*.json
.benchmarkci
coverage/lcov.info
node_modules
docs/node_modules

bonito
docs/build
.DS_Store
docs/src/.vitepress/cache
docs/src/.vitepress/dist
Expand All @@ -35,4 +27,4 @@ docs/.vscode
docs/node_modules
docs/.vitepress/cache
docs/.vitepress/dist
docs/.DS_Store
docs/.DS_Store
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ YAXArrayBase = "90b8fcef-0c2d-428d-9c56-5f86629e9d14"
[compat]
CFTime = "0.0, 0.1"
DataStructures = "0.17, 0.18"
DimensionalData = "0.24, 0.25"
DimensionalData = "0.24, 0.25, 0.26"
DiskArrayTools = "0.1"
DiskArrays = "0.3,0.4"
DocStringExtensions = "0.8, 0.9"
Expand Down
20 changes: 20 additions & 0 deletions docs/contributors.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using GitHub

function getavatars(; n = 90)
contri = GitHub.contributors("JuliaDataCubes/YAXArrays.jl")[1]
avatars = []
contributions = []
urls = []
for i in eachindex(contri)
push!(avatars, contri[i]["contributor"].avatar_url.uri)
push!(contributions, contri[i]["contributions"])
push!(urls, contri[i]["contributor"].html_url.uri)
end
p = sortperm(contributions, rev=true)
return avatars[p], urls[p]
end

avatars, urls = getavatars(; n = 90)
for (i,a) in enumerate(avatars)
println("""<a href="$(urls[i])" target="_blank"><img src="$(a)"></a>""")
end
4 changes: 4 additions & 0 deletions docs/logo.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using GLMakie.Colors
using GLMakie
using Random
Random.seed!(13)
50 changes: 7 additions & 43 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,62 +1,26 @@
using Documenter
using DocumenterVitepress
# add https://github.com/LuxDL/DocumenterVitepress.jl.git
# add DimensionalData#main
using YAXArrays

makedocs(; sitename="YAXArrays.jl",
authors="Fabian Gans et al.",
modules=[YAXArrays],
warnonly = true,
checkdocs=:all,
format=DocumenterVitepress.MarkdownVitepress(),
format=DocumenterVitepress.MarkdownVitepress(
repo = "github.com/JuliaDataCubes/YAXArrays.jl", # this must be the full URL!
devbranch = "master",
devurl = "dev";
),
draft=false,
source="src",
build=joinpath(@__DIR__, "build")
build= "build",
)

# To edit the sidebar, you must edit `docs/src/.vitepress/config.mts`.

# We manually obtain the Documenter deploy configuration,
# so we can use it to set Vitepress's settings.
# TODO: make this better / encapsulate it in `makedocs`
# so the user does not need to know!
deploy_config = Documenter.auto_detect_deploy_system()
deploy_decision = Documenter.deploy_folder(
deploy_config;
repo="github.com/JuliaDataCubes/YAXArrays.jl.git", # this must be the full URL!
devbranch="master",
devurl = "dev",
push_preview=true,
)

# VitePress relies on its config file in order to understand where files will exist.
# We need to modify this file to reflect the correct base URL, however, Documenter
# only knows about the base URL at the time of deployment.

# So, after building the Markdown, we need to modify the config file to reflect the
# correct base URL, and then build the VitePress site.
folder = deploy_decision.subfolder
println("Deploying to $folder")
vitepress_config_file = joinpath(@__DIR__, "build", ".vitepress", "config.mts")
config = read(vitepress_config_file, String)
new_config = replace(
config,
"base: 'REPLACE_ME_WITH_DOCUMENTER_VITEPRESS_BASE_URL_WITH_TRAILING_SLASH'" => "base: '/YAXArrays.jl/$(folder)$(isempty(folder) ? "" : "/")'"
)
write(vitepress_config_file, new_config)

# Build the docs using `npm` - we are assuming it's installed here!
haskey(ENV, "CI") && begin
cd(@__DIR__) do
run(`npm run docs:build`)
end
touch(joinpath(@__DIR__, "build", ".vitepress", "dist", ".nojekyll"))
end

deploydocs(;
repo="github.com/JuliaDataCubes/YAXArrays.jl.git", # this must be the full URL!
target="build/.vitepress/dist", # this is where Vitepress stores its output
target="build", # this is where Vitepress stores its output
branch = "gh-pages",
devbranch="master",
push_preview = true
Expand Down
128 changes: 0 additions & 128 deletions docs/mkdocs.yml

This file was deleted.

6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"docs:dev": "vitepress dev build",
"docs:build": "vitepress build build",
"docs:preview": "vitepress preview build"
"docs:dev": "vitepress dev build/.documenter",
"docs:build": "vitepress build build/.documenter",
"docs:preview": "vitepress preview build/.documenter"
},
"devDependencies": {
"markdown-it": "^14.0.0",
Expand Down
29 changes: 20 additions & 9 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import mathjax3 from "markdown-it-mathjax3";

// https://vitepress.dev/reference/site-config
export default defineConfig({
base: 'REPLACE_ME_WITH_DOCUMENTER_VITEPRESS_BASE_URL_WITH_TRAILING_SLASH',
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
title: "YAXArrays.jl",
description: "Yet another xarray-like Julia package",
lastUpdated: true,
cleanUrls: true,
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
ignoreDeadLinks: true,

markdown: {
Expand Down Expand Up @@ -42,6 +43,7 @@ export default defineConfig({
{ text: 'Setting chunks size', link: '/UserGuide/setchuncks' },
{ text: 'Apply functions on YAXArrays', link: '/UserGuide/applyfunctions' },
{ text: 'Create Cube from function', link: '/UserGuide/create_cube_from_function' },
{ text: 'Group by', link: '/UserGuide/group_by' },
{ text: 'Distributed computing', link: '/UserGuide/distributed' },
{ text: 'Open NetCDF', link: '/UserGuide/openNetCDF' },
{ text: 'Open Zarr (Store)', link: '/UserGuide/openZarr' },
Expand All @@ -51,13 +53,20 @@ export default defineConfig({
{ text: 'Overview', link: '/tutorials/tutorial' },
{ text: 'Plotting maps', link: '/tutorials/plottingmaps' },
{ text: 'Mean Seasonal Cycle', link: '/tutorials/mean_seasonal_cycle' },
{ text: 'ESDL study 3', link: '/tutorials/examples_from_esdl_study_3' },
{ text: 'ESDL study 4', link: '/tutorials/examples_from_esdl_study_4' },
{ text: 'ESDL studies',
items: [
{ text: 'ESDL study 1', link: '/tutorials/esdl/examples_from_esdl_study_1' },
{ text: 'ESDL study 2', link: '/tutorials/esdl/examples_from_esdl_study_2' },
{ text: 'ESDL study 3', link: '/tutorials/esdl/examples_from_esdl_study_3' },
{ text: 'ESDL study 4', link: '/tutorials/esdl/examples_from_esdl_study_4' },
]
},
]},
{ text: 'How do I?',
items: [
{ text: 'How do I ...', link: '/HowdoI/howdoi' },
{ text: 'Contribute to docs', link: '/HowdoI/contribute' }
{ text: 'Contribute to docs', link: '/HowdoI/contribute' },
{ text: 'Contributors', link: '/contributors' }
]},
],

Expand All @@ -71,6 +80,7 @@ export default defineConfig({
{ text: 'Setting chunks size', link: '/UserGuide/setchuncks' },
{ text: 'Apply functions on YAXArrays', link: '/UserGuide/applyfunctions' },
{ text: 'Create Cube from function', link: '/UserGuide/create_cube_from_function' },
{ text: 'Group by', link: '/UserGuide/group_by' },
{ text: 'Distributed computing', link: '/UserGuide/distributed' },
{ text: 'Open NetCDF', link: '/UserGuide/openNetCDF' },
{ text: 'Open Zarr (Store)', link: '/UserGuide/openZarr' },
Expand All @@ -79,21 +89,22 @@ export default defineConfig({
items: [
{ text: 'Overview', link: '/tutorials/tutorial' },
{ text: 'Plotting maps', link: '/tutorials/plottingmaps' },
{ text: 'Mean Seasonal Cycle', link: '/tutorials/mean_seasonal_cycle' },
{ text: 'ESDL study 3', link: '/tutorials/examples_from_esdl_study_3' },
{ text: 'ESDL study 4', link: '/tutorials/examples_from_esdl_study_4' },
{ text: 'Mean Seasonal Cycle', link: '/tutorials/mean_seasonal_cycle' }
]},
{ text: 'How do I?',
items: [
{ text: 'How do I ...', link: '/HowdoI/howdoi' },
{ text: 'Contribute to docs', link: '/HowdoI/contribute' }
{ text: 'Contribute to docs', link: '/HowdoI/contribute' },
]},
{ text: 'Contributors', link: '/contributors' },
{ text: 'API',
items: [
{ text: 'API Reference', link: 'api' },
]},
],

editLink: {
pattern: 'https://github.com/JuliaDataCubes/YAXArrays.jl/edit/master/docs/src/:path'
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl' }
],
Expand Down
Loading

0 comments on commit 02dc6c5

Please sign in to comment.