Browse Source

Fix devurl when running on Travis CI, fixes #87.

pull/88/head
Fredrik Ekre 6 years ago
parent
commit
d0e81beafd
  1. 3
      src/Literate.jl
  2. 12
      test/runtests.jl

3
src/Literate.jl

@ -230,7 +230,8 @@ function create_configuration(inputfile; user_config, user_kwargs) @@ -230,7 +230,8 @@ function create_configuration(inputfile; user_config, user_kwargs)
if haskey(ENV, "HAS_JOSH_K_SEAL_OF_APPROVAL") # Travis CI
repo_slug = get(ENV, "TRAVIS_REPO_SLUG", "unknown-repository")
deploy_folder = if get(ENV, "TRAVIS_PULL_REQUEST", nothing) == "false"
get(ENV, "TRAVIS_TAG", get(user_config, "devurl", "dev"))
t = get(ENV, "TRAVIS_TAG", "")
isempty(t) ? get(user_config, "devurl", "dev") : t
else
"previews/PR$(get(ENV, "TRAVIS_PULL_REQUEST", "##"))"
end

12
test/runtests.jl

@ -312,7 +312,7 @@ const GITLAB_ENV = Dict( @@ -312,7 +312,7 @@ const GITLAB_ENV = Dict(
# Travis with with PR preview build
withenv(TRAVIS_ENV...,
"TRAVIS_TAG" => nothing,
"TRAVIS_TAG" => "",
"TRAVIS_PULL_REQUEST" => "42") do
Literate.script(inputfile, outdir)
end
@ -323,7 +323,7 @@ const GITLAB_ENV = Dict( @@ -323,7 +323,7 @@ const GITLAB_ENV = Dict(
# Travis with no tag -> dev directory
withenv(TRAVIS_ENV...,
"TRAVIS_TAG" => nothing) do
"TRAVIS_TAG" => "") do
Literate.script(inputfile, outdir)
end
script = read(joinpath(outdir, "inputfile.jl"), String)
@ -512,7 +512,7 @@ end end @@ -512,7 +512,7 @@ end end
# Travis with PR preview build
withenv(TRAVIS_ENV...,
"TRAVIS_TAG" => nothing,
"TRAVIS_TAG" => "",
"TRAVIS_PULL_REQUEST" => "42") do
Literate.markdown(inputfile, outdir)
end
@ -524,7 +524,7 @@ end end @@ -524,7 +524,7 @@ end end
# Travis with no tag -> dev directory
withenv(TRAVIS_ENV...,
"TRAVIS_TAG" => nothing) do
"TRAVIS_TAG" => "") do
Literate.markdown(inputfile, outdir)
end
markdown = read(joinpath(outdir, "inputfile.md"), String)
@ -794,7 +794,7 @@ end end @@ -794,7 +794,7 @@ end end
# no tag -> latest directory
withenv(TRAVIS_ENV...,
"TRAVIS_TAG" => nothing) do
"TRAVIS_TAG" => "") do
Literate.notebook(inputfile, outdir, execute = false)
end
notebook = read(joinpath(outdir, "inputfile.ipynb"), String)
@ -951,7 +951,7 @@ end end @@ -951,7 +951,7 @@ end end
# Overwriting of URLs
withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl",
"TRAVIS_TAG" => nothing,
"TRAVIS_TAG" => "",
"TRAVIS_PULL_REQUEST" => "false",
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do
Literate.script(inputfile, outdir; config=config)

Loading…
Cancel
Save