From 0fa53f402c442e17d22196ca14842a9bafb9ba3b Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 10 Sep 2018 15:43:31 -0700 Subject: [PATCH 1/4] try standardising coverage --- appveyor.yml | 6 ++++-- bin/install.ps1 | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a359714..10193e5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,6 +6,8 @@ environment: - julia_version: 0.7.0 - julia_version: 1 - julia_version: nightly + coveralls: true + codecov: true platform: - x86 @@ -45,5 +47,5 @@ test_script: - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" on_success: - - echo "%JL_CODECOV_SCRIPT%" - - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" + - echo "%JL_SUCCESS_SCRIPT%" + - C:\julia\bin\julia -e "%JL_SUCCESS_SCRIPT%" diff --git a/bin/install.ps1 b/bin/install.ps1 index e72478d..3169609 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -52,20 +52,46 @@ if ($env:APPVEYOR_REPO_NAME -match "(\w+?)\/(\w+?)(?:\.jl)?$") { $projectname = $matches[2] } + +# Coverage + +$coverage = "" +if (Test-Path env:CODECOV) { + $coverage += "Codecov.submit(process_folder());" +} +if (Test-Path env:COVERALLS) { + $coverage += "Coveralls.submit(process_folder());" +} + if ($julia_version -ge [Version]"0.7") { if (Test-Path "Project.toml") { $env:JULIA_PROJECT = "@." # TODO: change this to --project="@." $env:JL_BUILD_SCRIPT = "using Pkg; Pkg.build()" $env:JL_TEST_SCRIPT = "using Pkg; Pkg.test(coverage=true)" + $env:JL_SUCCESS_SCRIPT = "using Pkg;" + if ($coverage -ne "") { + $env:JL_SUCCESS_SCRIPT += "Pkg.add(\`"Coverage\`"); using Coverage; $coverage" + } + # to be removed in next iteration $env:JL_CODECOV_SCRIPT = "using Pkg; Pkg.add(\`"Coverage\`"); using Coverage; Codecov.submit(process_folder())" } else { $env:JL_BUILD_SCRIPT = "using Pkg; Pkg.clone(pwd(), \`"$projectname\`"); Pkg.build(\`"$projectname\`")" $env:JL_TEST_SCRIPT = "using Pkg; Pkg.test(\`"$projectname\`", coverage=true)" + $env:JL_SUCCESS_SCRIPT = "using Pkg;" + if ($coverage -ne "") { + $env:JL_SUCCESS_SCRIPT += "cd(Pkg.dir(\`"$projectname\`")); Pkg.add(\`"Coverage\`"); using Coverage; $coverage" + } + # to be removed in next iteration $env:JL_CODECOV_SCRIPT = "using Pkg; cd(Pkg.dir(\`"$projectname\`")); Pkg.add(\`"Coverage\`"); using Coverage; Codecov.submit(process_folder())" } } else { $env:JL_BUILD_SCRIPT = "Pkg.clone(pwd(), \`"$projectname\`"); Pkg.build(\`"$projectname\`")" $env:JL_TEST_SCRIPT = "Pkg.test(\`"$projectname\`", coverage=true)" + $env:JL_SUCCESS_SCRIPT = "" + if ($coverage -ne "") { + $env:JL_SUCCESS_SCRIPT += "cd(Pkg.dir(\`"$projectname\`")); Pkg.add(\`"Coverage\`"); using Coverage; $coverage" + } + # to be removed in next iteration $env:JL_CODECOV_SCRIPT = "cd(Pkg.dir(\`"$projectname\`")); Pkg.add(\`"Coverage\`"); using Coverage; Codecov.submit(process_folder())" } From 683d5706c28f963900e7a142187f1bf688766ca6 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 10 Sep 2018 16:11:20 -0700 Subject: [PATCH 2/4] coveralls not yet working --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 10193e5..48c737b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ environment: - julia_version: 0.7.0 - julia_version: 1 - julia_version: nightly - coveralls: true +# coveralls: true codecov: true platform: From 97a1ab6193bdedef5a2e2a30340209bb91704a3c Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 10 Sep 2018 16:15:50 -0700 Subject: [PATCH 3/4] user coveralls token --- appveyor.yml | 3 ++- bin/install.ps1 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 48c737b..4ee1a85 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,8 +6,9 @@ environment: - julia_version: 0.7.0 - julia_version: 1 - julia_version: nightly -# coveralls: true codecov: true + coveralls_repo_token: + secure: Qkud4b8Xxxi2QEM+hvq0xTOkk7kJG7ND2MDjdY/btOouq6jauYA9kCz60VHDtWRA platform: - x86 diff --git a/bin/install.ps1 b/bin/install.ps1 index 3169609..215d445 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -59,7 +59,7 @@ $coverage = "" if (Test-Path env:CODECOV) { $coverage += "Codecov.submit(process_folder());" } -if (Test-Path env:COVERALLS) { +if (Test-Path env:COVERALLS_REPO_TOKEN) { $coverage += "Coveralls.submit(process_folder());" } From 59e2aa798cecc91e9c51aac248cd719b2ddc901e Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 14 Sep 2018 11:52:09 -0700 Subject: [PATCH 4/4] update readme --- README.md | 37 ++++++++++++++++++++++++++++++------- appveyor.yml | 2 +- bin/install.ps1 | 4 ++-- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 779a2a7..c642a75 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Appveyor.jl [![Build status](https://ci.appveyor.com/api/projects/status/rbca6b6qclxqdhwx/branch/version-1?svg=true)](https://ci.appveyor.com/project/simonbyrne/appveyor-jl) -[![codecov.io](http://codecov.io/github/JuliaCI/Appveyor.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaCI/Appveyor.jl?branch=master) +[![codecov.io](http://codecov.io/github/JuliaCI/Appveyor.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaCI/Appveyor.jl?branch=version-1) +[![Coveralls](https://coveralls.io/repos/github/JuliaCI/Appveyor.jl/badge.svg?branch=version-1)](https://coveralls.io/github/JuliaCI/Appveyor.jl?branch=version-1) This contains a "universal" Appveyor script for Julia repositories, making it easier to set up matrix builds and keep URLs up-to-date. @@ -15,6 +16,10 @@ environment: - julia_version: 0.7 - julia_version: 1 - julia_version: nightly +# codecov: true +# coveralls_token: +# secure: XXXXX + platform: - x86 # 32-bit @@ -48,15 +53,33 @@ test_script: - echo "%JL_TEST_SCRIPT%" - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" -# # Uncomment to support code coverage upload. Should only be enabled for packages -# # which would have coverage gaps without running on Windows -# on_success: -# - echo "%JL_CODECOV_SCRIPT%" -# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" +on_success: + - echo "%JL_SUCCESS_SCRIPT%" + - C:\julia\bin\julia -e "%JL_SUCCESS_SCRIPT%" ``` -Adjust `julia_version` numbers as needed. Accepted are: +## Julia versions + +Adjust `julia_version` environment variable as needed. Accepted are: - `nightly`: for latest [nightly build](https://julialang.org/downloads/nightlies.html). - `1`: for latest version 1 major release - x.y: for latest x.y minor release - x.y.z: for exact x.y.z release + +## Coverage + +The script supports automatic uploading of coverage statistics to various online services. + +### Codecov + +1. Enable [Codecov.io](https://codecov.io/) on the repository. +2. Add a `codecov` environment variable. + +If the repository is private, you will need to provide a `CODECOV_TOKEN`, similar to Coveralls below. + +### Coveralls + +1. Enable [Coveralls.io](https://coveralls.io/) on the repository. +2. Copy the provided secret token. +3. Encrypt the token at https://ci.appveyor.com/tools/encrypt +4. Provide the encrypted token as a [secure environment variable](https://www.appveyor.com/docs/how-to/secure-files/#decrypting-files-during-an-appveyor-build) `coveralls_token` (see the example above). diff --git a/appveyor.yml b/appveyor.yml index 4ee1a85..fd37035 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ environment: - julia_version: 1 - julia_version: nightly codecov: true - coveralls_repo_token: + coveralls_token: secure: Qkud4b8Xxxi2QEM+hvq0xTOkk7kJG7ND2MDjdY/btOouq6jauYA9kCz60VHDtWRA platform: diff --git a/bin/install.ps1 b/bin/install.ps1 index 215d445..8ddb225 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -56,10 +56,10 @@ if ($env:APPVEYOR_REPO_NAME -match "(\w+?)\/(\w+?)(?:\.jl)?$") { # Coverage $coverage = "" -if (Test-Path env:CODECOV) { +if (Test-Path env:CODECOV -or Test-Path env:CODECOV_TOKEN) { $coverage += "Codecov.submit(process_folder());" } -if (Test-Path env:COVERALLS_REPO_TOKEN) { +if (Test-Path env:COVERALLS_TOKEN) { $coverage += "Coveralls.submit(process_folder());" }