TeamCity, Git, and Karma, on Windows Azure

January 08, 2014 | JavaScript | Unit Testing

Note: After following this post, the end result is pretty awesome:

Image

Radio Edit (tl;dr)

  1. Create a new Virtual Machine on Windows Azure to install and access TeamCity.
  2. Install NodeJS (x86) and make sure the installation adds Node, npm, and modules to the PATH environment variable.
  3. Install Karma and karma-teamcity-reporter plugin.
  4. Install Chrome.
  5. Install Git and add its binaries folder to the PATH environment variable.
  6. Log in to TeamCity.
    1. Create a Build Configuration on TeamCity.
    2. Create and attach new VCS root to the newly created Build Configuration.
    3. Add a Build Step and attach the newly created Build Configuration.
    4. In the runner type select Command Line.
    5. Set the working directory to Karma's config folder.
    6. In the run option select “Executable with parameters”.
    7. In the command executable option enter karma.
    8. In the command parameters option enter start karma.conf.js --reporters teamcity --single-run.
  7. Include the karma-teamcity-reporter plugin in the karma.conf.js file triggering that way also the build process.

Club Mix (long version)

Create a new Virtual Machine on Windows Azure to install and access TeamCity.

Image

Image

Image

Optional: Generate SSH keys if you use SSH keys to establish a secure connection between the Virtual Machine and Git.

Install TeamCity and choose a port so it can be accessed from a browser (e.g. port 80).

Image

If you use SSH keys to establish a secure connection between the Virtual Machine and Git, make sure to run TeamCity Server under a user account that can access the path where the SSH keys are saved.

Use the whoami command in the Command Prompt to find out the Virtual Machine's domain name.

Image

Add a new inbound rule to Windows Firewall with the TeamCity Server port that was entered during installation.

The remaining steps can be also done from the browser.


On Windows Azure Management Portal add a new endpoint with the selected TeamCity Server port that was entered during installation.

Image

Log in to the TeamCity Server:

Image

For the demo, I forked the angular-phonecat project.

Image

Select an authentication method and test the connection.

Image Image

Add a Build Step and attach the newly created Build Configuration.

Image

Image

As a last step, include the karma-teamcity-reporter plugin in the karma.conf.js file.

Image

Push to Git to trigger the build process and see the commit on TeamCity Server.

Image

The end result is pretty awesome:

Image Image