-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Julia Pkg extensions and remove InteractiveDynamics (#206)
* update readme badges and CI * use pkg extrensions in project * add extension file * port docstrings into main package * update version * port source code here from InterDyn * port visualization doc file * update make.jl * add stdlib dependencies * add documentation workflow to correct folder * remove all refernecs to interactivedynamics * also from docs/project * remove this libass thing * fix typo in make.jl * add DataStructures to dependencies * fix the typos * fix all docs problems * finish all doc updates!!!!! * fix using latest makie version
- Loading branch information
Showing
29 changed files
with
1,505 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
name: CompatHelper | ||
|
||
on: | ||
schedule: | ||
- cron: '00 * * * *' | ||
|
||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
jobs: | ||
CompatHelper: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
julia-version: [1] | ||
julia-arch: [x86] | ||
os: [ubuntu-latest] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: julia-actions/setup-julia@latest | ||
- name: Check if Julia is already available in the PATH | ||
id: julia_in_path | ||
run: which julia | ||
continue-on-error: true | ||
- name: Install Julia, but only if it is not already available in the PATH | ||
uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.julia-version }} | ||
- name: Pkg.add("CompatHelper") | ||
run: julia -e 'using Pkg; Pkg.add("CompatHelper")' | ||
- name: CompatHelper.main() | ||
version: '1' | ||
arch: ${{ runner.arch }} | ||
if: steps.julia_in_path.outcome != 'success' | ||
- name: "Add the General registry via Git" | ||
run: | | ||
import Pkg | ||
ENV["JULIA_PKG_SERVER"] = "" | ||
Pkg.Registry.add("General") | ||
shell: julia --color=yes {0} | ||
- name: "Install CompatHelper" | ||
run: | | ||
import Pkg | ||
name = "CompatHelper" | ||
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" | ||
version = "3" | ||
Pkg.add(; name, uuid, version) | ||
shell: julia --color=yes {0} | ||
- name: "Run CompatHelper" | ||
run: | | ||
import CompatHelper | ||
CompatHelper.main() | ||
shell: julia --color=yes {0} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: julia -e 'using CompatHelper; CompatHelper.main()' | ||
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} | ||
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ on: | |
pull_request: | ||
branches: | ||
- master | ||
- '**' # matches every branch | ||
push: | ||
branches: | ||
- master | ||
|
@@ -16,7 +17,7 @@ jobs: | |
matrix: | ||
version: | ||
- '1' | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
os: [ubuntu-latest] # adjust according to need, e.g. os: [ubuntu-latest] if testing only on linux | ||
arch: | ||
- x64 | ||
steps: | ||
|
@@ -33,7 +34,7 @@ jobs: | |
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: actions/cache@v2 | ||
- uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
|
@@ -43,55 +44,10 @@ jobs: | |
${{ runner.os }}-test-${{ env.cache-name }}- | ||
${{ runner.os }}-test- | ||
${{ runner.os }}- | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
|
||
docs: | ||
name: Documentation | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1' | ||
os: | ||
- ubuntu-18.04 | ||
arch: | ||
- x64 | ||
steps: | ||
# Cancel ongoing documentation build if pushing to branch again before the previous | ||
# build is finished. | ||
- name: Cancel ongoing builds and checkout | ||
uses: styfle/[email protected] | ||
- uses: julia-actions/julia-runtest@v1 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
- uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
path: ~/.julia/artifacts | ||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-test-${{ env.cache-name }}- | ||
${{ runner.os }}-test- | ||
${{ runner.os }}- | ||
- name: Install binary dependencies | ||
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 Julia dependencies | ||
run: > | ||
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' | ||
julia --project=docs -e ' | ||
using Pkg | ||
Pkg.develop(PackageSpec(path=pwd())) | ||
Pkg.instantiate()' | ||
- name: Generate documentation and deploy | ||
env: # needed for pushing to gh-pages branch | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} | ||
run: > | ||
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' | ||
julia --project=docs --color=yes docs/make.jl | ||
file: lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,17 +12,15 @@ jobs: | |
uses: actions/checkout@v2 | ||
with: | ||
ref: gh-pages | ||
|
||
- name: Delete preview and history | ||
- name: Delete preview and history + push changes | ||
run: | | ||
git config user.name "Documenter.jl" | ||
git config user.email "[email protected]" | ||
git rm -rf "previews/PR$PRNUM" | ||
git commit -m "delete preview" | ||
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) | ||
if [ -d "previews/PR$PRNUM" ]; then | ||
git config user.name "Documenter.jl" | ||
git config user.email "[email protected]" | ||
git rm -rf "previews/PR$PRNUM" | ||
git commit -m "delete preview" | ||
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) | ||
git push --force origin gh-pages-new:gh-pages | ||
fi | ||
env: | ||
PRNUM: ${{ github.event.number }} | ||
|
||
- name: Push changes | ||
run: | | ||
git push --force origin gh-pages-new:gh-pages | ||
PRNUM: ${{ github.event.number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: '*' | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
- name: Install dependencies | ||
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' | ||
- name: Build and deploy | ||
env: | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ Manifest.toml | |
update* | ||
*.scss | ||
*.css | ||
*.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
CI = get(ENV, "CI", nothing) == "true" || get(ENV, "GITHUB_TOKEN", nothing) !== nothing | ||
|
||
import Pkg | ||
Pkg.pkg"add Documenter@1" | ||
|
||
# Load documenter | ||
using Documenter | ||
using DocumenterTools: Themes | ||
ENV["JULIA_DEBUG"] = "Documenter" | ||
|
||
# For easier debugging when downloading from a specific branch. | ||
github_user = "JuliaDynamics" | ||
branch = "master" | ||
download_path = "https://raw.githubusercontent.com/$github_user/doctheme/$branch" | ||
|
||
import Downloads | ||
for file in ("juliadynamics-lightdefs.scss", "juliadynamics-darkdefs.scss", "juliadynamics-style.scss") | ||
Downloads.download("$download_path/$file", joinpath(@__DIR__, file)) | ||
end | ||
|
||
# create the themes | ||
for w in ("light", "dark") | ||
header = read(joinpath(@__DIR__, "juliadynamics-style.scss"), String) | ||
theme = read(joinpath(@__DIR__, "juliadynamics-$(w)defs.scss"), String) | ||
write(joinpath(@__DIR__, "juliadynamics-$(w).scss"), header*"\n"*theme) | ||
end | ||
|
||
# compile the themes | ||
Themes.compile(joinpath(@__DIR__, "juliadynamics-light.scss"), joinpath(@__DIR__, "src/assets/themes/documenter-light.css")) | ||
Themes.compile(joinpath(@__DIR__, "juliadynamics-dark.scss"), joinpath(@__DIR__, "src/assets/themes/documenter-dark.css")) | ||
|
||
# Download and apply CairoMakie plotting style | ||
using CairoMakie | ||
Downloads.download("$download_path/style.jl", joinpath(@__DIR__, "style.jl")) | ||
include("style.jl") | ||
|
||
""" | ||
build_docs_with_style(pages::Vector, modules... ; | ||
bib = nothing, authors = "George Datseris and contributors", | ||
htmlkw = NamedTuple(), kw... | ||
) | ||
Call the `makedocs` function with some predefined style components. | ||
The first module dictates site name, while the rest need to be included | ||
to expand and cross-referrence docstrings from other modules. | ||
`kw` are propagated to `makedocs` while `htmlkw` are propagated to | ||
`Documenter.HTML`. | ||
""" | ||
function build_docs_with_style(pages, modules...; | ||
bib = nothing, authors = "George Datseris", draft = false, | ||
htmlkw = NamedTuple(), kwargs... | ||
) | ||
settings = ( | ||
modules = [modules...], | ||
format = Documenter.HTML(; | ||
prettyurls = CI, | ||
assets = [ | ||
asset("https://fonts.googleapis.com/css?family=Montserrat|Source+Code+Pro&display=swap", class=:css), | ||
], | ||
collapselevel = 3, | ||
htmlkw..., | ||
), | ||
sitename = "$(modules[1]).jl", | ||
authors, | ||
pages, | ||
draft, | ||
doctest = false, | ||
checkdocs = :exported, | ||
linkcheck_timeout = 2, | ||
# The following Documenter fails will NOT ERROR the docbuild! | ||
warnonly = [:doctest, :missing_docs], | ||
kwargs... | ||
) | ||
|
||
if isnothing(bib) | ||
makedocs(; settings...) | ||
else | ||
makedocs(; plugins=[bib], settings...) | ||
end | ||
|
||
if CI | ||
deploydocs( | ||
repo = "github.com/JuliaDynamics/$(modules[1]).jl.git", | ||
target = "build", | ||
push_preview = true | ||
) | ||
end | ||
|
||
end |
Oops, something went wrong.