diff options
| author | deepak1556 <[email protected]> | 2014-02-16 16:01:36 +0530 |
|---|---|---|
| committer | deepak1556 <[email protected]> | 2014-02-16 16:01:36 +0530 |
| commit | b6b215c613b98c4f781709e41ebe0b6a8894acb5 (patch) | |
| tree | 974b5a1bc50ba96ce87d9e2ecc1962b767b989bf | |
| parent | 2e7b8e1722e6bba13b288714730a7c91cac449ec (diff) | |
| download | node-coveralls-b6b215c613b98c4f781709e41ebe0b6a8894acb5.tar.xz node-coveralls-b6b215c613b98c4f781709e41ebe0b6a8894acb5.zip | |
add support for drone ci
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | lib/getOptions.js | 7 | ||||
| -rw-r--r-- | test/getOptions.js | 27 |
3 files changed, 35 insertions, 1 deletions
@@ -5,7 +5,7 @@ [Coveralls.io](https://coveralls.io/) support for node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button ( like the one above ) to your README. -Supported CI services: [travis-ci](https://travis-ci.org/), [codeship](https://www.codeship.io/), [circle-ci](https://circleci.com/), [jenkins](http://jenkins-ci.org/) +Supported CI services: [travis-ci](https://travis-ci.org/), [codeship](https://www.codeship.io/), [circle-ci](https://circleci.com/), [jenkins](http://jenkins-ci.org/), [drone](https://drone.io/) ##Installation: Add the latest version of `coveralls` to your package.json: diff --git a/lib/getOptions.js b/lib/getOptions.js index 3641ffc..68016aa 100644 --- a/lib/getOptions.js +++ b/lib/getOptions.js @@ -14,6 +14,13 @@ var getBaseOptions = function(cb){ options.service_job_id = process.env.TRAVIS_JOB_ID; } + if (process.env.DRONE){ + options.service_name = 'drone'; + options.service_job_id = process.env.DRONE_BUILD_NUMBER; + git_commit = process.env.DRONE_COMMIT; + git_branch = process.env.DRONE_BRANCH; + } + if (process.env.JENKINS_URL){ options.service_name = 'jenkins'; options.service_job_id = process.env.BUILD_ID; diff --git a/test/getOptions.js b/test/getOptions.js index 76691a3..a0aef46 100644 --- a/test/getOptions.js +++ b/test/getOptions.js @@ -49,6 +49,9 @@ describe("getBaseOptions", function(){ it ("should set service_name and service_job_id if it's running on codeship", function(done){ testCodeship(getBaseOptions, done); }); + it ("should set service_name and service_job_id if it's running on drone", function(done){ + testDrone(getBaseOptions, done); + }); }); describe("getOptions", function(){ @@ -119,6 +122,9 @@ describe("getOptions", function(){ it ("should set service_name and service_job_id if it's running on codeship", function(done){ testCodeship(getOptions, done); }); + it ("should set service_name and service_job_id if it's running on drone", function(done){ + testDrone(getBaseOptions, done); + }); }); var testServiceJobId = function(sut, done){ @@ -303,6 +309,27 @@ var testCodeship = function(sut, done) { }); }; +var testDrone = function(sut, done) { + process.env.DRONE = true; + process.env.DRONE_BUILD_NUMBER = '1234'; + process.env.DRONE_COMMIT = "e3e3e3e3e3e3e3e3e"; + process.env.DRONE_BRANCH = "master"; + sut(function(err, options){ + options.service_name.should.equal("drone"); + options.service_job_id.should.equal("1234"); + options.git.should.eql({ head: + { id: 'e3e3e3e3e3e3e3e3e', + author_name: 'Unknown Author', + author_email: '', + committer_name: 'Unknown Committer', + committer_email: '', + message: 'Unknown Commit Message' }, + branch: 'master', + remotes: [] }); + done(); + }); +}; + function ensureLocalGitContext(options) { var path = require('path'); var fs = require('fs'); |
