[Pkg-javascript-commits] [node-coveralls] 248/332: added gitlab-ci support
Bastien Roucariès
rouca at moszumanska.debian.org
Thu Nov 9 13:54:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-coveralls.
commit c931ed671d058f28be26b9148f821e1330c7e57c
Author: Nick Merwin <n at mer.io>
Date: Fri Feb 26 11:13:37 2016 -0800
added gitlab-ci support
---
lib/getOptions.js | 14 +++++++++++---
package.json | 2 +-
test/getOptions.js | 25 +++++++++++++++++++++++++
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/lib/getOptions.js b/lib/getOptions.js
index 4c53e36..682920b 100644
--- a/lib/getOptions.js
+++ b/lib/getOptions.js
@@ -28,7 +28,7 @@ var getBaseOptions = function(cb){
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;
+ git_branch = process.env.DRONE_BRANCH;
}
*/
@@ -63,7 +63,15 @@ var getBaseOptions = function(cb){
options.service_name = 'wercker';
options.service_job_id = process.env.WERCKER_BUILD_ID;
git_commit = process.env.WERCKER_GIT_COMMIT;
- git_branch = process.env.WERCKER_GIT_BRANCH;
+ git_branch = process.env.WERCKER_GIT_BRANCH;
+ }
+
+ if (process.env.GITLAB_CI){
+ options.service_name = 'gitlab-ci';
+ options.service_job_number = process.env.CI_BUILD_NAME;
+ options.service_job_id = process.env.CI_BUILD_ID;
+ git_commit = process.env.CI_BUILD_REF;
+ git_branch = process.env.CI_BUILD_REF_NAME;
}
options.run_at = process.env.COVERALLS_RUN_AT || JSON.stringify(new Date()).slice(1, -1);
@@ -131,7 +139,7 @@ var getOptions = function(cb, _userOptions){
getBaseOptions(function(err, options){
// minimist populates options._ with non-option command line arguments
var firstNonOptionArgument = index.options._[0];
-
+
if (firstNonOptionArgument)
options.filepath = firstNonOptionArgument;
diff --git a/package.json b/package.json
index 7e7f4e1..819e213 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"coverage",
"coveralls"
],
- "version": "2.11.6",
+ "version": "2.11.7",
"bugs": {
"url": "https://github.com/nickmerwin/node-coveralls/issues"
},
diff --git a/test/getOptions.js b/test/getOptions.js
index 897427c..4bbe7d6 100644
--- a/test/getOptions.js
+++ b/test/getOptions.js
@@ -138,6 +138,9 @@ describe("getOptions", function(){
it ("should set service_name and service_job_id if it's running on wercker", function(done){
testWercker(getOptions, done);
});
+ it ("should set service_name and service_job_id if it's running on Gitlab", function(done){
+ testGitlab(getOptions, done);
+ });
it ("should override set options with user options", function(done){
var userOptions = {service_name: 'OVERRIDDEN_SERVICE_NAME'};
process.env.COVERALLS_SERVICE_NAME = "SERVICE_NAME";
@@ -382,6 +385,28 @@ var testWercker = function(sut, done) {
});
};
+var testGitlab = function(sut, done) {
+ process.env.GITLAB_CI = true;
+ process.env.CI_BUILD_NAME = 'spec:one';
+ process.env.CI_BUILD_ID = "1234";
+ process.env.CI_BUILD_REF = "e3e3e3e3e3e3e3e3e";
+ process.env.CI_BUILD_REF_NAME = "feature";
+ sut(function(err, options){
+ options.service_name.should.equal("gitlab-ci");
+ 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: 'feature',
+ remotes: [] });
+ done();
+ });
+};
+
function ensureLocalGitContext(options) {
var path = require('path');
var fs = require('fs');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git
More information about the Pkg-javascript-commits
mailing list