diff --git a/.travis.yml b/.travis.yml index 89a1971..3e0d1b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,5 @@ before_script: - git config --global user.name "Travis" - git config --global user.email "travis@example.com" after_success: - - julia -e 'using Pkg; Pkg.add("Coverage")' - - julia -e 'using Coverage; CodeCov.submit(process_folder())' + - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; CodeCov.submit(process_folder())' - julia -e 'using Pkg; Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))' diff --git a/defaults/appveyor.yml b/defaults/appveyor.yml index 6ae2557..05f2a33 100644 --- a/defaults/appveyor.yml +++ b/defaults/appveyor.yml @@ -1,49 +1,33 @@ +# Documentation: https://github.com/JuliaCI/Appveyor.jl environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/{{VERSION}}/julia-{{VERSION}}-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/{{VERSION}}/julia-{{VERSION}}-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - + - julia_version: {{VERSION}} + - julia_version: nightly +platform: + - x86 + - x64 matrix: allow_failures: - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - + - julia_version: nightly branches: only: - master - /release-.*/ - notifications: - provider: Email on_build_success: false on_build_failure: false on_build_status_changed: false - install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" - # 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 - + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: - # Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); Pkg.clone(pwd(), \"{{PKGNAME}}\"); Pkg.build(\"{{PKGNAME}}\")" - + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"{{PKGNAME}}\"{{#AFTER}}; coverage=true{{/AFTER}})" -{{#AFTER}} - -after_test: + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" {{#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}} -{{#COVERALLS}} - - C:\projects\julia\bin\julia -e "cd(Pkg.dir(\"{{PKGNAME}}\")); Pkg.add(\"Coverage\"); using Coverage; Coveralls.submit(process_folder())" -{{/COVERALLS}} -{{/AFTER}} diff --git a/defaults/gitlab-ci.yml b/defaults/gitlab-ci.yml index 49f1693..4c2e37e 100644 --- a/defaults/gitlab-ci.yml +++ b/defaults/gitlab-ci.yml @@ -2,44 +2,21 @@ stages: - test - coverage - {{/GITLABCOVERAGE}} -.test_template: &test_template +Julia {{VERSION}}: stage: test -{{#GITLABCOVERAGE}} - artifacts: - name: coverage - expire_in: 2 hours - paths: - - coverage/ -{{/GITLABCOVERAGE}} + image: julia:{{VERSION}} tags: - docker 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}} - - cp -r $(julia -e 'print(Pkg.dir("{{PKGNAME}}", "src"))') coverage -{{/GITLABCOVERAGE}} - -Julia {{VERSION}}: - image: julia:{{VERSION}} - <<: *test_template - -Julia nightly: - image: staticfloat/julia:nightly-x64 - allow_failure: true - <<: *test_template -{{#GITLABCOVERAGE}} - -"Coverage": +Coverage: stage: coverage coverage: /Test Coverage (\d+\.\d+%)/ image: julia:{{VERSION}} tags: - docker - before_script: - - apt-get update && apt-get -y install git make unzip gcc bzip2 - 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)' + before_script: 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)' {{/GITLABCOVERAGE}} diff --git a/defaults/travis.yml b/defaults/travis.yml index 7c4b7eb..1186c4c 100644 --- a/defaults/travis.yml +++ b/defaults/travis.yml @@ -12,18 +12,18 @@ matrix: fast_finish: true notifications: email: false -script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia -e 'Pkg.clone(pwd()); Pkg.build("{{PKGNAME}}"); Pkg.test("{{PKGNAME}}"{{#AFTER}}; coverage=true{{/AFTER}})' +{{#COVERAGE}} +script: julia -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)' +{{/COVERAGE}} {{#AFTER}} after_success: {{#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}} {{#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}} {{#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}} {{/AFTER}} diff --git a/src/generate.jl b/src/generate.jl index 6f754f0..164b05e 100644 --- a/src/generate.jl +++ b/src/generate.jl @@ -289,6 +289,10 @@ function substitute( ) # d["AFTER"] is true whenever something needs to occur in a CI "after_script". 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)) end diff --git a/src/plugin.jl b/src/plugin.jl index 6f73ec6..c9a83f0 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -257,7 +257,7 @@ function interactive( plugin_type::Type{<:GenericPlugin}; 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 # "MyPlugin" to be called "myplugin.yml". fn = file != nothing && isempty(file) ? "$(lowercase(plugin_name)).yml" : file diff --git a/src/plugins/githubpages.jl b/src/plugins/githubpages.jl index f4cd481..a843573 100644 --- a/src/plugins/githubpages.jl +++ b/src/plugins/githubpages.jl @@ -58,7 +58,7 @@ function gen_plugin( deploydocs(; repo="github.com/$(template.user)/$pkg_name.jl", target="build", - julia="0.6", + julia="1.0", deps=nothing, make=nothing, ) diff --git a/test/plugins/appveyor.jl b/test/plugins/appveyor.jl index 1b156d1..db0d15d 100644 --- a/test/plugins/appveyor.jl +++ b/test/plugins/appveyor.jl @@ -34,10 +34,8 @@ pkg_dir = joinpath(temp_dir, test_pkg) @test gen_plugin(p, t, temp_dir, test_pkg) == [".appveyor.yml"] @test isfile(joinpath(pkg_dir, ".appveyor.yml")) appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String) - @test !occursin("coverage=true", appveyor) - @test !occursin("after_test", appveyor) - @test !occursin("Codecov.submit", appveyor) - @test !occursin("Coveralls.submit", appveyor) + @test !occursin("on_success", appveyor) + @test !occursin("%JL_CODECOV_SCRIPT%", appveyor) rm(joinpath(pkg_dir, ".appveyor.yml")) # 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) delete!(t.plugins, CodeCov) appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String) - @test occursin("coverage=true", appveyor) - @test occursin("after_test", appveyor) - @test occursin("Codecov.submit", appveyor) - @test !occursin("Coveralls.submit", appveyor) + @test occursin("on_success", appveyor) + @test occursin("%JL_CODECOV_SCRIPT%", appveyor) rm(joinpath(pkg_dir, ".appveyor.yml")) - # Coveralls should do the same. - 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")) + # TODO: Add Coveralls tests when AppVeyor.jl supports it. p = AppVeyor(; config_file=nothing) @test isempty(gen_plugin(p, t, temp_dir, test_pkg)) diff --git a/test/plugins/gitlabci.jl b/test/plugins/gitlabci.jl index 2af3b9f..eab750c 100644 --- a/test/plugins/gitlabci.jl +++ b/test/plugins/gitlabci.jl @@ -50,7 +50,6 @@ pkg_dir = joinpath(temp_dir, test_pkg) @test gen_plugin(p, t, temp_dir, test_pkg) == [".gitlab-ci.yml"] @test isfile(joinpath(pkg_dir, ".gitlab-ci.yml")) gitlab = read(joinpath(pkg_dir, ".gitlab-ci.yml"), String) - @test occursin("test_template", gitlab) # The default plugin should enable the coverage step. @test occursin("using Coverage", gitlab) rm(joinpath(pkg_dir, ".gitlab-ci.yml"))