diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..ab1a941b --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,34 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + + - name: go mod tidy check + run: | + go mod tidy + git diff --exit-code -- go.mod go.sum + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Require: The version of golangci-lint to use. + # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. + # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. + version: latest + + - name: Test # Run the golang tests! + run: make test + diff --git a/Makefile b/Makefile index 58f4a901..ac3c37ce 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,10 @@ go/mocks: ## Generates Go mock files. mockery; \ done +.PHONY: test +test: ## Run the unit tests + @go test -v -cover ./... + HELP_FORMAT=" \033[36m%-25s\033[0m %s\n" .PHONY: help help: ## Display this usage information diff --git a/internal/pkg/heredoc/heredoc_test.go b/internal/pkg/heredoc/heredoc_test.go index 530a950e..1a4ee74e 100644 --- a/internal/pkg/heredoc/heredoc_test.go +++ b/internal/pkg/heredoc/heredoc_test.go @@ -97,6 +97,7 @@ The name of the group to delete. The name may be specified as either: for _, c := range cases { c := c t.Run(c.Name, func(t *testing.T) { + t.Parallel() r := require.New(t) io := iostreams.Test() f := New(io)