Setting up a complete CI Solution for a project

With this lab, I continued working on my library that I created. Although originally my library was pure JavaScript/HTML, I changed it over to Node for some new experience. This required me to modify some of my functions.

This lab has taught me how to set a continuous integrated environment. In simpler words, continuous integration is a process of automating the build and testing of code for every new commit. My first experience with automated code testing came as I pushed first bug fix, I received a message saying my code didn't get accepted because Travis CI build failed. This time, I got to set up my entire build and test process.



There are a few files that are needed for a continuous integration process. The first thing needed was a way to tell TravisCI how to configure, build, and test my project. To do this, I created a .travis.yml file in my root folder, which holds the language used, as well as the appropriate versions. Next, I used the package.json file to automate my scripts, my dependencies, and other information. I love the ability to create these automated scripts. Notice the install script above. If I am to continue writing this code on a new machine, or maybe my colleague wants to contribute, they would need to write out all these commands to get the same working environment as myself. This script automated the entire process, allowing a developer on another machine focus on the code and not on how to properly set up the environment. This way, there's no need to upload all my extra node_modules, the script will automatically install everything. That's absolutely fantastic!



Now onto creating automated tests. I created a separate directory for my test cases. I had some troubles understanding how to write these test cases, how do they work, do they need to be in the same directory as the source files, and so on. My main problem was that I had all my functions in a main file, file-info.js, once I split the function up into their own files, the test cases started working properly. In no time I had all my tests passing.




My current progress on the library can be found here. For the next lab, I will be learning different documenting techniques for an open source project.

Comments

Popular posts from this blog

DPS911 - Release 3

DPS911 - Release 2

DPS911 - Release 1