DEV Community

Artem Tanyhin
Artem Tanyhin

Posted on

1

Continuous Integration and Go

Hey there! Thanks for coming by. Today, I want to tell you how I created a Continuous Integration workflow for SSGo using GitHub Actions, as well as how I created some tests for a different Open Source repo. Maybe you'll find something useful, too!

CI Workflow

For my start, I decided to stick with GitHub's official guide, which also conveniently included running unit tests, which I described in my earlier post.

I made sure to specify Go version as 1.16 as this is the version that switched ioutil.ReadFile to os.ReadFile.

Adding linter

golangci-lint has a beautiful GitHub Actions installation guide, so I used that and didn't have to worry about setting up VM linters on my own. Very nice!

Adding Node.js unit tests

Repo I picked for adding unit tests is izyum, which is another SSG written in Node.js and TypeScript.

I added some unit tests for a couple file utility functions. Since it involved file system, I had to use jest.mock on fs module. After I was done with my changes, I opened a pull request.

Summary

Continuous Integration is crucial for keeping the project clean and working. Automatic tests and linting is right what every Open Source project needs, so I would encourage every repo manager to consider adding CI. You'll thank me later, haha!

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay