Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parallel Build steps in Team City

I am Pretty new to Team City and have been set with a task of creating a CI build.

The thing I trying to build is an angular2 app with protractor e2e tests.

All the other build steps in Team City run ok but I am having trouble trying to run the step that does the e2e test.

if I was to do this locally I would open a cmd window and type...

npm run start

I would then open another command window and type...

npm run e2e 

How do I run parallel steps in Team City?

like image 562
dazziep Avatar asked Jan 06 '23 17:01

dazziep


2 Answers

Build steps cannot be run parallel in TeamCity. What you need to do, is create a script that runs 'npm run start' in background, and then runs 'npm run e2e'. You can use command line runner to run the script

like image 198
Oleg Rybak Avatar answered Jan 13 '23 12:01

Oleg Rybak


I still couldn't get the forever thing working properly for me so I created my own node script that fires up live-server and then executes npm run e2e and that seems to have done the trick thanks for your help though Oleg.

This is how I did it in the end...

const exec = require('child_process').exec;
var psTree = require('ps-tree');

const server = exec('live-server ./dist --port=3000 --no-browser');
const tests = exec('npm run e2e');

tests.stdout.on('data', function(data) {
  console.log(data);
});
tests.stderr.on('data', function(data) {
  console.log(data);
});
tests.on('close', function(code) {
  console.log('closing code: ' + code);
  exec('taskkill /PID ' + server.pid + ' /T /F');
});
like image 32
dazziep Avatar answered Jan 13 '23 13:01

dazziep