diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..6dc10b8 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,64 @@ +name: CI +on: + push: + branches: + - main + pull_request: +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1' + os: + - ubuntu-latest + arch: + - x64 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - 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 }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: '1' + - run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - run: | + julia --project=docs -e ' + using Documenter: DocMeta, doctest + using ERPExplorer + DocMeta.setdocmeta!(ERPExplorer, :DocTestSetup, :(using ERPExplorer); recursive=true) + doctest(ERPExplorer)' + - run: julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..cba9134 --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,16 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Pkg.add("CompatHelper") + run: julia -e 'using Pkg; Pkg.add("CompatHelper")' + - name: CompatHelper.main() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..f49313b --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,15 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..33acf68 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,8 @@ +name: Format suggestions +on: + pull_request: +jobs: + code-style: + runs-on: ubuntu-latest + steps: + - uses: julia-actions/julia-format@v2.0.0 diff --git a/Project.toml b/Project.toml index 9bc2d44..8066c42 100644 --- a/Project.toml +++ b/Project.toml @@ -17,8 +17,12 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TopoPlots = "2bdbdf9c-dbd8-403f-947b-1a4e0dd41a7a" Unfold = "181c99d8-e21b-4ff3-b70b-c233eddec679" UnfoldMakie = "69a5ce3b-64fb-4f22-ae69-36dd4416af2a" UnfoldSim = "ed8ae6d2-84d3-44c6-ab46-0baf21700804" WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008" + +[compat] +Test = "1.11.0" diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..f148578 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,10 @@ +[deps] +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +DataFramesMeta = "1313f7d8-7da2-5740-9ea0-a2ca25f37964" +DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +ERPExplorer = "a0936657-5da6-42c1-a2f2-44cfa89f194c" +Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" +Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" +Unfold = "181c99d8-e21b-4ff3-b70b-c233eddec679" diff --git a/scripts/gen_data.jl b/docs/gen_data.jl similarity index 100% rename from scripts/gen_data.jl rename to docs/gen_data.jl diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..c9ab412 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,4 @@ +# ERPExplorer Highlights + +# ERPExplorer.jl allows interactive exploration of regression-ERPs. +# You can switch on and off formula terms, term values, row and column faceting, line colours and style, marker style. \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..426c46c --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,48 @@ +using ERPExplorer +using Documenter +using DocStringExtensions + +# preload once + +using CairoMakie +const Makie = CairoMakie # - for references +using Unfold +using DataFrames +using DataFramesMeta +using Literate +using Glob + +GENERATED = joinpath(@__DIR__, "src", "generated") +SOURCE = joinpath(@__DIR__, "literate") +for subfolder ∈ ["intro"] #["how_to", "intro", "tutorials", "explanations"] + local SOURCE_FILES = Glob.glob(subfolder * "/*.jl", SOURCE) + foreach(fn -> Literate.markdown(fn, GENERATED * "/" * subfolder), SOURCE_FILES) +end + +DocMeta.setdocmeta!(ERPExplorer, :DocTestSetup, :(using ERPExplorer); recursive = true) + +makedocs(; + modules = [ERPExplorer], + authors = "Vladimir Mikheev, Simon Danisch, Benedikt Ehinger", + repo = Documenter.Remotes.GitHub("s-ccs", "ERPExplorer.jl"), + sitename = "ERPExplorer.jl", + warnonly = :cross_references, + format = Documenter.HTML(; + prettyurls = get(ENV, "CI", "false") == "true", + canonical = "https://s-css.github.io/ERPExplorer.jl", + assets = String[], + ), + pages = [ + "ERPExplorer highlights" => "index.md", + #"Plotting" => "generated/intro/toposeries.md", + #"Diagnostics" => "generated/intro/gnostics.md", + "API / DocStrings" => "api.md", + ], +) + +deploydocs(; + repo = "github.com/s-ccs/ERPExplorer.jl", + devbranch = "main", + versions = "v#.#", + push_preview = true, +) diff --git a/docs/run_liveserver.jl b/docs/run_liveserver.jl new file mode 100644 index 0000000..85879e6 --- /dev/null +++ b/docs/run_liveserver.jl @@ -0,0 +1,7 @@ +using LiveServer +servedocs( + skip_dir = joinpath("src", "generated"), + literate_dir = joinpath("literate"), + literate = joinpath("literate"), + foldername = ".", +) diff --git a/docs/src/api.md b/docs/src/api.md new file mode 100644 index 0000000..c8e69d9 --- /dev/null +++ b/docs/src/api.md @@ -0,0 +1,6 @@ +```@autodocs +Modules = [ERPExplorer] +Order = [:function] +``` + +Internally, we use a `PlotConfig` struct to keep track of common plotting options, so that all functions have a similar API. \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..c9ab412 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,4 @@ +# ERPExplorer Highlights + +# ERPExplorer.jl allows interactive exploration of regression-ERPs. +# You can switch on and off formula terms, term values, row and column faceting, line colours and style, marker style. \ No newline at end of file diff --git a/src/formula_extractor.jl b/src/formula_extractor.jl index d5b1336..84e1e59 100644 --- a/src/formula_extractor.jl +++ b/src/formula_extractor.jl @@ -1,4 +1,6 @@ const BSplineTerm = Base.get_extension(Unfold, :UnfoldBSplineKitExt).BSplineTerm + + get_sym(t::InterceptTerm) = "" get_sym(t::AbstractTerm) = t.sym get_sym(t::BSplineTerm) = t.term.sym diff --git a/test/basic.jl b/test/basic.jl new file mode 100644 index 0000000..c6e1cf1 --- /dev/null +++ b/test/basic.jl @@ -0,0 +1,9 @@ +dataS, evts, pos2d = gen_data() +formulaS = @formula(0 ~ 1 + luminance + fruit + animal) +times = range(0, length = size(dataS, 2), step = 1 ./ 100) +model = Unfold.fit(UnfoldModel, formulaS, evts, dataS, times) +_, positions = TopoPlots.example_data() + +@testset "basic test" begin + explore(model; positions = positions) +end diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..527755f --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1 @@ +include("setup.jl") diff --git a/test/setup.jl b/test/setup.jl new file mode 100644 index 0000000..3e8deed --- /dev/null +++ b/test/setup.jl @@ -0,0 +1,5 @@ +using ERPExplorer +using Test + +path = dirname(Base.current_project()) +include(path * "/docs/gen_data.jl")