Skip to content

Commit

Permalink
ci: setup codecov (#9)
Browse files Browse the repository at this point in the history
* ci: setup codecov
* chore: add codecov badge
---------

Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
  • Loading branch information
TylerGillson authored Aug 9, 2024
1 parent 4479259 commit bfecef9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Unshallow
run: git fetch --prune --unshallow

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
go-version-file: go.mod

- name: Test
run: make test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bin/*
!bin/.gitkeep
_build
.DS_Store
cover.out
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,32 @@ GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)

##@ Help Targets

help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[0m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Test Targets

.PHONY: test
test: static ## Run tests
@mkdir -p _build/cov
go test -covermode=atomic -coverpkg=./... -coverprofile _build/cov/coverage.out ./... -timeout 120m
go test -covermode=atomic -coverpkg=./... -coverprofile cover.out ./... -timeout 120m

##@ Static Analysis Targets

static: fmt lint vet

fmt: ## Run go fmt against code
go fmt ./...

lint: golangci-lint ## Run golangci-lint
$(GOLANGCI_LINT) run

vet: ## Run go vet against code
go vet ./...

## Tools & binaries
##@ Tool & Binary Targets

golangci-lint:
if ! test -f $(BIN_DIR)/golangci-lint-linux-amd64; then \
curl -LOs https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCI_VERSION)/golangci-lint-$(GOLANGCI_VERSION)-linux-amd64.tar.gz; \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![Test](https://github.com/spectrocloud-labs/prompts-tui/actions/workflows/ci.yaml/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/spectrocloud-labs/prompts-tui)](https://goreportcard.com/report/github.com/spectrocloud-labs/prompts-tui)
[![codecov](https://codecov.io/github/spectrocloud-labs/prompts-tui/graph/badge.svg?token=4PF6DI8LU1)](https://codecov.io/github/spectrocloud-labs/prompts-tui)
[![Go Reference](https://pkg.go.dev/badge/github.com/spectrocloud-labs/prompts-tui.svg)](https://pkg.go.dev/github.com/spectrocloud-labs/prompts-tui)

# prompts-tui
Expand Down

0 comments on commit bfecef9

Please sign in to comment.