For this week in Topics in Open Source Development we were tasked with adding continuous integration tests into an existing project. The project that I will be enhancing is til-to-html - a markdown to static HTML site generator.
Bun CI Workflow
Last week, I added automated unit tests to my project. This time, I will add a CI workflow
Up until now, whenever code was merged into the main branch, it was up to the maintainer (me) to manually run tests on incoming code. Now, a workflow will be triggered when anyone attempts to push to or create a pull request to be merged onto the main branch. As this is a Bun.sh application, I followed the official setup guide to run Bun in GitHub Actions.
The workflow file I created does the following:
- Whenever someone:
- pushes to the main branch, or
- creates a pull request for the main branch…
- GitHub Actions will run a job that:
- installs Bun using Bun's official setup-bun routine
- uses the latest version of bun
- installs all package dependencies
- runs a build
- runs all unit tests
If any of these steps fail, the push/pull request is rejected.
Bun CI Workflow: https://github.com/paulkim26/til-to-html/blob/main/.github/workflows/bun.yml
Adding tests to a partner's project
(coming soon)
Takeaways
This is the first time I incorporated an automatic CI testing workflow into a project. I enjoyed how straightforward and well documented the process was. Adding a CI workflow alleviates a lot of anxiety when it comes to integrating code not just from other developers, but from me as well. These are all checks and balances I would have had to worry and remember to execute myself - there's no reason not to automate these trivial tasks.
Thanks for reading!
Top comments (0)