Update default file templates

This commit is contained in:
Chris de Graaf 2018-09-26 15:49:10 -05:00
parent e2c615faf8
commit 18f5e2d0c0
9 changed files with 39 additions and 89 deletions

View File

@ -17,6 +17,5 @@ before_script:
- git config --global user.name "Travis" - git config --global user.name "Travis"
- git config --global user.email "travis@example.com" - git config --global user.email "travis@example.com"
after_success: after_success:
- julia -e 'using Pkg; Pkg.add("Coverage")' - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; CodeCov.submit(process_folder())'
- julia -e 'using Coverage; CodeCov.submit(process_folder())'
- julia -e 'using Pkg; Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))' - julia -e 'using Pkg; Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))'

View File

@ -1,49 +1,33 @@
# Documentation: https://github.com/JuliaCI/Appveyor.jl
environment: environment:
matrix: matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/{{VERSION}}/julia-{{VERSION}}-latest-win32.exe" - julia_version: {{VERSION}}
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/{{VERSION}}/julia-{{VERSION}}-latest-win64.exe" - julia_version: nightly
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" platform:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - x86
- x64
matrix: matrix:
allow_failures: allow_failures:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - julia_version: nightly
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
branches: branches:
only: only:
- master - master
- /release-.*/ - /release-.*/
notifications: notifications:
- provider: Email - provider: Email
on_build_success: false on_build_success: false
on_build_failure: false on_build_failure: false
on_build_status_changed: false on_build_status_changed: false
install: install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
build_script: build_script:
# Need to convert from shallow to complete for Pkg.clone to work - echo "%JL_BUILD_SCRIPT%"
- IF EXIST .git\shallow (git fetch --unshallow) - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
- C:\projects\julia\bin\julia -e "versioninfo(); Pkg.clone(pwd(), \"{{PKGNAME}}\"); Pkg.build(\"{{PKGNAME}}\")"
test_script: test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"{{PKGNAME}}\"{{#AFTER}}; coverage=true{{/AFTER}})" - echo "%JL_TEST_SCRIPT%"
{{#AFTER}} - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
after_test:
{{#CODECOV}} {{#CODECOV}}
- C:\projects\julia\bin\julia -e "cd(Pkg.dir(\"{{PKGNAME}}\")); Pkg.add(\"Coverage\"); using Coverage; Codecov.submit(process_folder())" on_success:
- echo "%JL_CODECOV_SCRIPT%"
- C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
{{/CODECOV}} {{/CODECOV}}
{{#COVERALLS}}
- C:\projects\julia\bin\julia -e "cd(Pkg.dir(\"{{PKGNAME}}\")); Pkg.add(\"Coverage\"); using Coverage; Coveralls.submit(process_folder())"
{{/COVERALLS}}
{{/AFTER}}

View File

@ -2,44 +2,21 @@
stages: stages:
- test - test
- coverage - coverage
{{/GITLABCOVERAGE}} {{/GITLABCOVERAGE}}
.test_template: &test_template Julia {{VERSION}}:
stage: test stage: test
{{#GITLABCOVERAGE}} image: julia:{{VERSION}}
artifacts:
name: coverage
expire_in: 2 hours
paths:
- coverage/
{{/GITLABCOVERAGE}}
tags: tags:
- docker - docker
script: script:
- julia -e 'Pkg.clone(pwd()); Pkg.build("{{PKGNAME}}"); Pkg.test("{{PKGNAME}}"{{#GITLABCOVERAGE}}; coverage=true{{/GITLABCOVERAGE}})' julia -e 'using Pkg; Pkg.build(); Pkg.test({{#GITLABCOVERAGE}}; coverage=true{{/GITLABCOVERAGE}})'
{{#GITLABCOVERAGE}} {{#GITLABCOVERAGE}}
- cp -r $(julia -e 'print(Pkg.dir("{{PKGNAME}}", "src"))') coverage Coverage:
{{/GITLABCOVERAGE}}
Julia {{VERSION}}:
image: julia:{{VERSION}}
<<: *test_template
Julia nightly:
image: staticfloat/julia:nightly-x64
allow_failure: true
<<: *test_template
{{#GITLABCOVERAGE}}
"Coverage":
stage: coverage stage: coverage
coverage: /Test Coverage (\d+\.\d+%)/ coverage: /Test Coverage (\d+\.\d+%)/
image: julia:{{VERSION}} image: julia:{{VERSION}}
tags: tags:
- docker - docker
before_script: before_script: apt-get update && apt-get -y install git make unzip gcc bzip2
- apt-get update && apt-get -y install git make unzip gcc bzip2 script: julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; c, t = get_summary(process_folder()); @printf("Test Coverage %.2f%%\n", 100c/t)'
script:
- rm -rf src && mv coverage src
- julia -e 'Pkg.add("Coverage"); using Coverage; c, t = get_summary(process_folder()); @printf("Test Coverage %.2f%%\n", 100c/t)'
{{/GITLABCOVERAGE}} {{/GITLABCOVERAGE}}

View File

@ -12,18 +12,18 @@ matrix:
fast_finish: true fast_finish: true
notifications: notifications:
email: false email: false
script: {{#COVERAGE}}
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi script: julia -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)'
- julia -e 'Pkg.clone(pwd()); Pkg.build("{{PKGNAME}}"); Pkg.test("{{PKGNAME}}"{{#AFTER}}; coverage=true{{/AFTER}})' {{/COVERAGE}}
{{#AFTER}} {{#AFTER}}
after_success: after_success:
{{#CODECOV}} {{#CODECOV}}
- julia -e 'cd(Pkg.dir("{{PKGNAME}}")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())' - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
{{/CODECOV}} {{/CODECOV}}
{{#COVERALLS}} {{#COVERALLS}}
- julia -e 'cd(Pkg.dir("{{PKGNAME}}")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())' - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'
{{/COVERALLS}} {{/COVERALLS}}
{{#DOCUMENTER}} {{#DOCUMENTER}}
- julia -e 'Pkg.add("Documenter"); cd(Pkg.dir("{{PKGNAME}}")); include(joinpath("docs", "make.jl"))' - julia -e 'using Pkg; Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))'
{{/DOCUMENTER}} {{/DOCUMENTER}}
{{/AFTER}} {{/AFTER}}

View File

@ -289,6 +289,10 @@ function substitute(
) )
# d["AFTER"] is true whenever something needs to occur in a CI "after_script". # d["AFTER"] is true whenever something needs to occur in a CI "after_script".
d["AFTER"] = d["DOCUMENTER"] || d["CODECOV"] || d["COVERALLS"] d["AFTER"] = d["DOCUMENTER"] || d["CODECOV"] || d["COVERALLS"]
# d["COVERAGE"] is true whenever a coverage plugin is enabled.
# TODO: This doesn't handle user-defined coverage plugins.
# Maybe we need an abstract CoveragePlugin <: GenericPlugin?
d["COVERAGE"] = d["CODECOV"] || d["COVERALLS"]
return substitute(template, merge(d, view)) return substitute(template, merge(d, view))
end end

View File

@ -257,7 +257,7 @@ function interactive(
plugin_type::Type{<:GenericPlugin}; plugin_type::Type{<:GenericPlugin};
file::Union{AbstractString, Nothing}="", file::Union{AbstractString, Nothing}="",
) )
plugin_name = String(split(string(plugin_type), ".")[end]) plugin_name = string(nameof(plugin_type))
# By default, we expect the default plugin file template for a plugin called # By default, we expect the default plugin file template for a plugin called
# "MyPlugin" to be called "myplugin.yml". # "MyPlugin" to be called "myplugin.yml".
fn = file != nothing && isempty(file) ? "$(lowercase(plugin_name)).yml" : file fn = file != nothing && isempty(file) ? "$(lowercase(plugin_name)).yml" : file

View File

@ -58,7 +58,7 @@ function gen_plugin(
deploydocs(; deploydocs(;
repo="github.com/$(template.user)/$pkg_name.jl", repo="github.com/$(template.user)/$pkg_name.jl",
target="build", target="build",
julia="0.6", julia="1.0",
deps=nothing, deps=nothing,
make=nothing, make=nothing,
) )

View File

@ -34,10 +34,8 @@ pkg_dir = joinpath(temp_dir, test_pkg)
@test gen_plugin(p, t, temp_dir, test_pkg) == [".appveyor.yml"] @test gen_plugin(p, t, temp_dir, test_pkg) == [".appveyor.yml"]
@test isfile(joinpath(pkg_dir, ".appveyor.yml")) @test isfile(joinpath(pkg_dir, ".appveyor.yml"))
appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String) appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String)
@test !occursin("coverage=true", appveyor) @test !occursin("on_success", appveyor)
@test !occursin("after_test", appveyor) @test !occursin("%JL_CODECOV_SCRIPT%", appveyor)
@test !occursin("Codecov.submit", appveyor)
@test !occursin("Coveralls.submit", appveyor)
rm(joinpath(pkg_dir, ".appveyor.yml")) rm(joinpath(pkg_dir, ".appveyor.yml"))
# Generating the plugin with CodeCov in the template should create a post-test step. # Generating the plugin with CodeCov in the template should create a post-test step.
@ -45,22 +43,11 @@ pkg_dir = joinpath(temp_dir, test_pkg)
gen_plugin(p, t, temp_dir, test_pkg) gen_plugin(p, t, temp_dir, test_pkg)
delete!(t.plugins, CodeCov) delete!(t.plugins, CodeCov)
appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String) appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String)
@test occursin("coverage=true", appveyor) @test occursin("on_success", appveyor)
@test occursin("after_test", appveyor) @test occursin("%JL_CODECOV_SCRIPT%", appveyor)
@test occursin("Codecov.submit", appveyor)
@test !occursin("Coveralls.submit", appveyor)
rm(joinpath(pkg_dir, ".appveyor.yml")) rm(joinpath(pkg_dir, ".appveyor.yml"))
# Coveralls should do the same. # TODO: Add Coveralls tests when AppVeyor.jl supports it.
t.plugins[Coveralls] = Coveralls()
gen_plugin(p, t, temp_dir, test_pkg)
delete!(t.plugins, Coveralls)
appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String)
@test occursin("coverage=true", appveyor)
@test occursin("after_test", appveyor)
@test occursin("Coveralls.submit", appveyor)
@test !occursin("Codecov.submit", appveyor)
rm(joinpath(pkg_dir, ".appveyor.yml"))
p = AppVeyor(; config_file=nothing) p = AppVeyor(; config_file=nothing)
@test isempty(gen_plugin(p, t, temp_dir, test_pkg)) @test isempty(gen_plugin(p, t, temp_dir, test_pkg))

View File

@ -50,7 +50,6 @@ pkg_dir = joinpath(temp_dir, test_pkg)
@test gen_plugin(p, t, temp_dir, test_pkg) == [".gitlab-ci.yml"] @test gen_plugin(p, t, temp_dir, test_pkg) == [".gitlab-ci.yml"]
@test isfile(joinpath(pkg_dir, ".gitlab-ci.yml")) @test isfile(joinpath(pkg_dir, ".gitlab-ci.yml"))
gitlab = read(joinpath(pkg_dir, ".gitlab-ci.yml"), String) gitlab = read(joinpath(pkg_dir, ".gitlab-ci.yml"), String)
@test occursin("test_template", gitlab)
# The default plugin should enable the coverage step. # The default plugin should enable the coverage step.
@test occursin("using Coverage", gitlab) @test occursin("using Coverage", gitlab)
rm(joinpath(pkg_dir, ".gitlab-ci.yml")) rm(joinpath(pkg_dir, ".gitlab-ci.yml"))