Skip to content

Commit

Permalink
docs: build and deploy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AldoGl committed Jun 24, 2024
1 parent 507c453 commit af74c12
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 10 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Documentation

permissions:
contents: write # Required when authenticating with `GITHUB_TOKEN`, not needed when authenticating with SSH deploy keys
pull-requests: read # Required when using `push_preview=true`
statuses: write # Optional, used to report documentation build statuses

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1.10'
- uses: julia-actions/cache@v1
- 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
1 change: 0 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
ABCredit = "91b5283e-3ff1-4617-8122-130c88cb8aba"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rm(outdir; force = true, recursive = true) # cleans up previous examples
mkpath(outdir)

Literate.markdown(joinpath(indir, "basic_example.jl"), outdir; credit = false)
Literate.markdown(joinpath(indir, "compare_histograms.jl"), outdir; credit = false)
# Literate.markdown(joinpath(indir, "compare_histograms.jl"), outdir; credit = false)
Literate.markdown(joinpath(indir, "parallel_evaluations.jl"), outdir; credit = false)

println("Documentation Build")
Expand All @@ -23,9 +23,9 @@ makedocs(
pages = [
"Home" => "index.md",
"Essentials" => "examples/basic_example.md",
"Model and data" => "examples/compare_histograms.md",
# "Model and data" => "examples/compare_histograms.md",
"Parallel evaluations" => "examples/parallel_evaluations.md",
"Runs from the terminal" => "running_from_the_terminal.md",
"Runs from the terminal" => "running_from_terminal.md",
"Code reference" => "api.md",
],
)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A fast, and simple to use, Julia implementation of the model in _Emergent dynami

```julia
using Pkg
Pkg.add(url="[email protected]:bancaditalia/ABCredit.jl.git")
Pkg.add("ABCredit")
```

## Quick example
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ model.params[:subsidy] = 0.0
# Now we run the mdel for T epochs, the results simulation will output a data collector "d" with several time series.

T = 1000
d = ABCredit.run_one_sim!(model, T; seed = 100)
d = ABCredit.run_one_sim!(model, T; seed = 100, burn_in = 100)

# If needed, we can save the simulation data to a CSV file as

Expand Down
2 changes: 1 addition & 1 deletion examples/parallel_evaluations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# import ABCredit.jl and other useful libraries

using ABCredit, StatsPlots, CSV, DataFrames
using ABCredit, StatsPlots

params = ABCredit.PARAMS_ORIGINAL

Expand Down
6 changes: 3 additions & 3 deletions test/seed_stability.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ABCredit
using Plots
using Random
using Test

Expand All @@ -20,8 +19,9 @@ model2 = ABCredit.initialise_model(W, F, N; params)
d1 = ABCredit.run_one_sim!(model1, T; seed = 1)
d2 = ABCredit.run_one_sim!(model2, T; seed = 1)

plot(d1.inflationRate)
plot!(d2.inflationRate)
# using Plots
# plot(d1.inflationRate)
# plot!(d2.inflationRate)

for name in fieldnames(typeof(d1))
@test getfield(d1, name) == getfield(d2, name)
Expand Down

0 comments on commit af74c12

Please sign in to comment.