Skip to content

Commit

Permalink
Set up documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jan 19, 2021
1 parent 4bb56a8 commit db6d488
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Documentation
on:
push:
branches: [master]
tags: '*'
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
# Build documentation on the latest Julia 1.x
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.instantiate();
Pkg.develop(PackageSpec(path=pwd()))'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
run: julia --project=docs/ docs/make.jl
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Dionysos

| **Build Status** |
|:----------------:|
| [![Build Status][build-img]][build-url] [![Codecov branch][codecov-img]][codecov-url] |
| **Documentation** | **Build Status** |
|:-----------------:|:----------------:|
| [![][docs-stable-img]][docs-stable-url] | [![Build Status][build-img]][build-url] |
| [![][docs-latest-img]][docs-latest-url] | [![Codecov branch][codecov-img]][codecov-url] |

[build-img]: https://github.com/blegat/Dionysos.jl/workflows/CI/badge.svg?branch=master
[build-url]: https://github.com/blegat/Dionysos.jl/actions?query=workflow%3ACI
[codecov-img]: http://codecov.io/github/blegat/Dionysos.jl/coverage.svg?branch=master
[codecov-url]: http://codecov.io/github/blegat/Dionysos.jl?branch=master
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg
[docs-stable-url]: https://dionysos-dev.github.io/Dionysos.jl/stable
[docs-latest-url]: https://dionysos-dev.github.io/Dionysos.jl/dev

[build-img]: https://github.com/dionysos-dev/Dionysos.jl/workflows/CI/badge.svg?branch=master
[build-url]: https://github.com/dionysos-dev/Dionysos.jl/actions?query=workflow%3ACI
[codecov-img]: http://codecov.io/github/dionysos-dev/Dionysos.jl/coverage.svg?branch=master
[codecov-url]: http://codecov.io/github/dionysos-dev/Dionysos.jl?branch=master
5 changes: 5 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "0.26"
35 changes: 35 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Dionysos
using Documenter, Literate

const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")

include(joinpath(EXAMPLES_DIR, "all_examples.jl"))

for example in EXAMPLES
example_filepath = joinpath(EXAMPLES_DIR, example)
Literate.markdown(example_filepath, OUTPUT_DIR)
Literate.notebook(example_filepath, OUTPUT_DIR)
Literate.script(example_filepath, OUTPUT_DIR)
end

makedocs(
sitename = "Dionysos",
# See https://github.com/JuliaDocs/Documenter.jl/issues/868
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
# See https://github.com/jump-dev/JuMP.jl/issues/1576
strict = true,
pages = [
"Index" => "index.md",
"Examples" => map(EXAMPLES) do jl_file
# Need `string` as Documenter fails if `name` is a `SubString{String}`.
name = string(split(jl_file, ".")[1])
return name => "generated/$name.md"
end
],
)

deploydocs(
repo = "github.com/dionysos-dev/Dionysos.jl.git",
push_preview = true,
)
3 changes: 3 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dionysos

[Dionysos](https://github.com/dionysos-dev/Dionysos.jl) implements a solver for the optimal control of cyber-physical systems.
1 change: 1 addition & 0 deletions examples/all_examples.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const EXAMPLES = String[]

0 comments on commit db6d488

Please sign in to comment.