mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 18:36:19 +00:00
add step timings to the build
This commit is contained in:
parent
46bfedc506
commit
b41b76884b
@ -92,6 +92,10 @@ Distributor.prototype._runNext = function(callback) {
|
||||
self._updateBuild(build, {currentStep: stepName});
|
||||
});
|
||||
|
||||
executor.on('stepTimingsChange', function(stepTimings) {
|
||||
self._updateBuild(build, {stepTimings: stepTimings});
|
||||
});
|
||||
|
||||
executor.on('data', function(data) {
|
||||
self.emit('buildData', build, data);
|
||||
});
|
||||
|
@ -33,20 +33,39 @@ Executor.prototype.hasScmChanges = function(callback) {
|
||||
|
||||
Executor.prototype.run = function(params, callback) {
|
||||
var self = this,
|
||||
project = _({}).extend(self.project, params);
|
||||
project = _({}).extend(self.project, params),
|
||||
getSourcesTiming = {name: 'get sources'},
|
||||
stepTimings = [],
|
||||
getSourcesStart = Date.now();
|
||||
|
||||
Steppy(
|
||||
function() {
|
||||
self.throttledEmit('currentStep', 'get sources');
|
||||
self.throttledEmit('currentStep', getSourcesTiming.name);
|
||||
self._getSources(project.scm, this.slot());
|
||||
},
|
||||
function(err, scmData) {
|
||||
getSourcesTiming.duration = Date.now() - getSourcesStart;
|
||||
stepTimings.push(getSourcesTiming);
|
||||
|
||||
self.emit('scmData', scmData);
|
||||
|
||||
var funcs = project.steps.map(function(step, index) {
|
||||
return function() {
|
||||
var start = Date.now(),
|
||||
stepCallback = this.slot();
|
||||
|
||||
self.throttledEmit('currentStep', step.name);
|
||||
self._runStep(step, this.slot());
|
||||
|
||||
var timing = {name: step.name};
|
||||
self._runStep(step, function(err) {
|
||||
timing.duration = Date.now() - start;
|
||||
stepTimings.push(timing);
|
||||
self.emit('stepTimingsChange', stepTimings);
|
||||
stepCallback(err);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
funcs.push(this.slot());
|
||||
Steppy.apply(this, funcs);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user