This repository showcases a Continuous Integration (CI) workflow for a Golang project using GitHub Actions and Codecov. The CI pipeline automatically builds the code, runs unit tests, and reports code coverage metrics via Codecov.
- Automated Code Build Utilizes GitHub Actions for automated code builds.
- Automated Unit Tests Automated unit tests to ensure code quality.
- Code Coverage Reporting Reports code coverage via Codecov.
- Easy-to-Follow Configuration Contains easy-to-follow GitHub Action YAML configuration files.
- Multi-Version Support Supports multiple versions using semantic versioning.
This repository demonstrates the implementation of four workflow jobs:
- Unit Testing: Automatically runs unit tests to ensure code functionality.
- Golang Style Checker: Uses the
golangci-lint
tool to check code style and quality. - Unit Testing Coverage Badge: Generates a badge indicating the coverage percentage of unit tests.
- Semantic Versioning: Implements semantic versioning to manage versions of the project.
- Security Scanning: Uses the
gosec
tools to scan golang source code for security problems
- Github Account Token
- Codecov Account Token
-
Fork and Clone the Repository
git clone git@github.com:devinwangg/go-ci-testing-workflow.git
-
Navigate to Project Directory
cd go-ci-testing-workflow
-
Run Tests Locally
make test
-
Generate Github Token and Codecov Token to Github Action secret
-
Push your changes to the GitHub repository
-
Check Code Coverage on Codecov Once the workflow is complete, check the code coverage report on your Codecov dashboard.
The main configuration for the GitHub Actions workflow is stored in .github/workflows
folder. Here you'll find the steps for building the code and running tests.