Continuous Integration
Tags: opensource, github, javascript, beginners
Published: 2021-11-19 18:33:41

This week, we are going to have out __Lab 9__ in `OSD600`. Similar to the Lab 8, Lab 9 is about to __improve__ our SSG at Github.
In this week, we learned something about the `Continuous Integration` (CI). "_CI is a method whereby we build and run our tests (i.e., integrate everything in our project) automatically whenever anything is pushed to the repo, or a new pull request is made. With CI we do this continually and ideally on every change. This lets us monitor the effect of a given change and assess its quality._"

###Procedure 
In this week, we have only __1__ video to watch. After watching the video that related to the `Continuous Integration` on __Github__. _I have a clear idea how to make an action workflow and how it supposed to work._

__Obviously__, the __first step__ I made was to create a new __workflow__ to my SSG. There wasn't that much things needed to do by myself. Most work were done by `Github` __automatically__. 

My __second step__ was to create a new `PR` to test my CI. Also, I made a new test file for the `mdNewFeature()` function that I have in my SSG. I created a new test file and some test functions for it. After I could run all the tests successfully in my local machine, I made a pull request to my __repository__. Here is a screenshot for the CI to check my PR:
![CI_Check_PR](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9xl7rkc97qq2w72api7.png)
Luckily, all my tests got checked so that I merged them to my repository.

__After that__, I tried to make a test that with __errors__ to check my CI. I updated my code so that it will have an error when I run the tests. And then I made a PR to my repository. When __Github__ receive my PR, it will run the workflow automatically. It will check my PR to make sure it won't crush my original program. 
Well, there was an warning showed up as I __expected__:
![CheckWithErrors](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4eitfg90cwny6j7m6tk0.png)
And because there was an error with the PR, there is __no way__ I can __merged__ them to my program. Therefore, I just reset the wrong code to the right one. Then I made the PR again. And this time, it didn't show my the error anymore and I can merge it to my repository.
![MergedPR](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsmf6euag88jsl9kdg2a.png)
__Moreover__, for this Lab 9 we need to test other people's CI as well. I found my partner [__Eugene__](https://github.com/ycechungAI/cmd-ssg) through Slack. And we talked about what is the good idea for adding a new test function to each repository. __Personally__, I just added a new small test function to my partner's program. It was a test function about testing what will happen if the user use the function with empty argument. Due to this is not a program that I made, I need to go through my partner's code and followed his logic to made up a test. It's slightly different when adding a test function to a program that you never participated in. But it became easy after you communicated with the program builder!


###My Feelings
__To be honest__, this is not a complicated lab, not at all. However, that doesn't mean it's a useless lab. In fact, I think this Lab 9 is a __very useful__ lab. It introduced me the `Continuous Integration` (CI), which is a __powerful tool__ while work on Github. It can __ensure__ that every PR that the contributor made or the repository made will not __crash__ the program. And all of them would run automatically. 
__This is a really good tool for me to work on Github in the future!__

Link to my Repository:[[My-First-SSG](https://github.com/DerekJxy/My-First-SSG)]