Setting up Documenter for private Gitlab with PkgTemplates

I am setting up a repo on a private gitlab using PkgTemplates.jl. The CI worked with no problem, however, the documentation deployment is not working. I don’t know if I need to pass additional information to Documenter, setup keys, or configure something in the repo settings. Any guidance would be greatly appreciated.

Setup

using PkgTemplates

template = Template(
    user="my_username", 
    host = "my_host", 
    plugins = [
        GitLabCI(), 
        Documenter{GitLabCI}()
    ]
)

Error

25 dependencies successfully precompiled in 52 seconds
┌ Warning: Unable to determine HTML(edit_link = ...) from remote HEAD branch, defaulting to "master".
│ Calling `git remote` failed with an exception. Set JULIA_DEBUG=Documenter to see the error.
│ Unless this is due to a configuration error, the relevant variable should be set explicitly.
└ @ Documenter ~/.julia/packages/Documenter/Bs999/src/utilities/utilities.jl:651
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: Skipped ExpandTemplates step (doctest only).
[ Info: Skipped CrossReferences step (doctest only).
[ Info: Skipped CheckDocument step (doctest only).
[ Info: Skipped Populate step (doctest only).
[ Info: Skipped RenderDocument step (doctest only).
Test Summary:               | Pass  Total
Doctests: gitlab_ci_example |    1      1
ERROR: LoadError: ArgumentError: Unable to automatically determine remote for main repo.
> `repo` is not set, and the Git repository has invalid origin.
Configure `repo` and/or `remotes` appropriately, or set `remotes = nothing` to disable remote source
links altogether (e.g. if not working in a Git repository

Stacktrace:
 [1] interpret_repo_and_remotes(; root::String, repo::String, remotes::Dict{Any, Any})
   @ Documenter ~/.julia/packages/Documenter/Bs999/src/documents.jl:654
 [2] Documenter.Document(; root::String, source::String, build::String, workdir::Symbol, format::Documenter.HTMLWriter.HTML, clean::Bool, doctest::Bool, linkcheck::Bool, linkcheck_ignore::Vector{Any}, linkcheck_timeout::Int64, linkcheck_useragent::String, checkdocs::Symbol, checkdocs_ignored_modules::Vector{Module}, doctestfilters::Vector{Regex}, warnonly::Vector{Symbol}, modules::Vector{Module}, pages::Vector{Pair{String, String}}, pagesonly::Bool, expandfirst::Vector{String}, plugins::Vector{Documenter.Plugin}, repo::String, remotes::Dict{Any, Any}, sitename::String, authors::String, version::String, highlightsig::Bool, draft::Bool, others::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Documenter ~/.julia/packages/Documenter/Bs999/src/documents.jl:437
 [3] #makedocs#87
   @ ~/.julia/packages/Documenter/Bs999/src/makedocs.jl:266 [inlined]
 [4] top-level scope

.gitlab-ci-yml

.script:
  script:
    - |
      julia --project=@. -e '
        using Pkg
        Pkg.build()
        Pkg.test(coverage=true)'
.coverage:
  coverage: /Test coverage (\d+\.\d+%)/
  after_script:
    - |
      julia -e '
        using Pkg
        Pkg.add("Coverage")
        using Coverage
        c, t = get_summary(process_folder())
        using Printf
        @printf "Test coverage %.2f%%\n" 100c / t'
Julia 1.11:
  image: julia:1.11
  extends:
    - .script
    - .coverage
Julia 1.6:
  image: julia:1.6
  extends:
    - .script
    - .coverage
pages:
  image: julia:1.6
  stage: deploy
  script:
    - |
      julia --project=docs -e '
        using Pkg
        Pkg.develop(PackageSpec(path=pwd()))
        Pkg.instantiate()
        using Documenter: doctest
        using gitlab_ci_example
        doctest(gitlab_ci_example)
        include("docs/make.jl")'
    - mkdir -p public
    - mv docs/build public/dev
  artifacts:
    paths:
      - public
  only:
    - master

1 Like

Try PkgTemplates.generate() instead. It’s interactive so it could allow you to choose a more relevant configuration easily.