DEV Community


Posted on

Adding Continuous Integration

This week we learned how to use the tests we made last week and directly implement them into our GitHub repositories. By adding continuous integration we no longer have to run our tests manually every time we make a new commit to our repos, instead it does it automatically every time we make a new pull request or merge into the main branch!

Since I've been coding my project using Visual Studio I used MSBuild as my workflow template, because Visual Studio uses MSBuild to compile and build projects when running the built in debugger. So that makes it easy to make sure that it will compile properly on GitHub's side. Other than that decision it was really easy to setup the YAML file, I just needed to add two lines:

run: msbuild LennahSSG.sln /p:OutDir=D:\a\LennahSSG\LennahSSG\LennahSSG
Enter fullscreen mode Exit fullscreen mode

to build the executable and

run: D:\a\LennahSSG\LennahSSG\LennahSSG\LennahSSG.exe -t
Enter fullscreen mode Exit fullscreen mode

to run the test.

After setting up my own CI and ensuring everything was working properly I teamed up with Andrew Tassone to work on his SSG. I added a new test case to his that would check for proper markdown conversion with the <h1> tag, you can check out the PR here. It was a bit more difficult to add a new test case to a different project, mainly because his structure for his project was still a larger collection of code, rather than many smaller functions. He did not refactor his project like I did so I had to think of how to test things with the project in one piece.

After setting up CI for the first time it is incredibly convenient. It is a bit annoying to set up tests the first time and then making sure they cover as many things as possible but once you have it up and running. Turning tests into CI is very simple to do and in the long run it makes adding new features and just making changes in general so much better, because then you will know when something breaks and where it breaks.

Top comments (0)