Run the Go module's tests.
This is the version of the workflow for projects using the Task task runner tool.
Install the test-go-task.yml
GitHub Actions workflow to .github/workflows/
Taskfile.yml
- Install to: repository root (or merge into the existing
Taskfile.yml
).
- Install to: repository root (or merge into the existing
Taskfile.yml
-DEFAULT_GO_MODULE_PATH
andDEFAULT_GO_PACKAGES
variables- Merge into
Taskfile.yml
- Merge into
Configure the version of Go used for development of the project in the env.GO_VERSION
field of test-go-task.yml
.
If the project contains Go modules in paths other than the root of the repository, add their paths to the job matrix in check-go-task.yml
at jobs.test.strategy.matrix.module[].path
and the Codecov flag to group their data under at jobs.test.strategy.matrix.module[].codecov-flags
Replace TODO_REPO_OWNER/TODO_REPO_NAME
with the repository's name (e.g., arduino/arduino-cli
) in the codecov/codecov-action
action's fail_ci_if_error
input in test-go-task.yml
.
Add the following to .gitignore
:
<application executable>
<application executable>.exe
(where "<application executable>
" is the filename of the Go application's executable)
Markdown badge:
[](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/test-go-task.yml)
[](https://codecov.io/gh/TODO_REPO_OWNER/TODO_REPO_NAME)
- Replace the
TODO_REPO_OWNER
andTODO_REPO_NAME
placeholders in the URLs with the final repository owner and name (example). - If the coverage badge should reflect the coverage for a branch named something other than
main
, adjust the badge URL accordingly.
Asciidoc badge:
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/test-go-task.yml/badge.svg["Test Go status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/test-go-task.yml"]
image:https://codecov.io/gh/{repository-owner}/{repository-name}/branch/main/graph/badge.svg["Codecov", link="https://codecov.io/gh/{repository-owner}/{repository-name}"]
- Define the
{repository-owner}
and{repository-name}
attributes and use them throughout the readme (example). - If the coverage badge should reflect the coverage for a branch named something other than
main
, adjust the badge URL accordingly.
Add CI workflow to test Go code
On every push and pull request that affects relevant files, run the project's Go code tests.
On every push and pull request that affects relevant files, run the project's [Go](https://golang.org/) code tests.