This week I added Continuous Integration to my open source project, TILerator.
GitHub Actions Workflow
I used GitHub Actions to set up my CI, which is a great platform you can use on GitHub to automate your builds, tests, and deployment pipeline. I created a ci.yml file and added a Unit Test job to run my tests with every push or pull request to the main branch.
Adding Tests to Another Project
I also had an opportunity to contribute tests to one of my classmate's project. They also used Jest for their project's testing framework, so it was fairly easy to set up new tests. Since I'm used to JavaScript and their project was built in TypeScript, I needed to brush up on the differences between them to avoid writing poor tests. It was interesting to see that for the tests I wrote for my program, I needed to validate the parameter types, but those kind of tests weren't needed in my classmate's project due to TypeScript being a strongly typed language. After reviewing their files, I found a function that converts Markdown syntax for code blocks into the appropriate HTML tags, and decided to write a few tests for that function. The tests I added can be found in this Pull Request.
Thoughts on CI
Now that I have set up CI for my project, I think that it's a great tool to use in your projects to automate tests and error checks. Making it so it checks any push or pull request to your repo for errors prevents any major or minor errors to slip by unnoticed. It was also quite easy setting it up through GitHub Actions, so I plan on adding CI to my future projects.
Top comments (0)