DEV Community

Cover image for Continuous Integration
DerekJxy
DerekJxy

Posted on

Continuous Integration

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
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
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
Moreover, for this Lab 9 we need to test other people's CI as well. I found my partner Eugene 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]

Top comments (0)