Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,5 @@ jobs:
- name: Check for vulnerabilities
run: nix develop --command govulncheck ./...

- name: golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2

- name: Build and Test
run: nix develop --command make
51 changes: 9 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,13 @@
PACKAGE := github.com/RedisLabs/rediscloud-go-api
.DEFAULT_GOAL := ci
.PHONY: fmt lint test ci

.DEFAULT_GOAL := all
.PHONY := clean all fmt coverage
fmt:
golangci-lint fmt

go_files := $(shell find . -type f -name '*.go' -print)
lint:
golangci-lint run

clean:
# Removing all generated files...
@rm -rf bin/ || true
test:
go test -v ./...

bin/.vendor: go.mod go.sum
# Downloading modules...
@go mod download
@mkdir -p bin/
@touch bin/.vendor

bin/.generate: $(go_files) bin/.vendor
@go generate ./...
@touch bin/.generate

fmt: bin/.generate $(go_files)
# Formatting files...
@goimports -w $(go_files)

bin/.vet: bin/.generate $(go_files)
go vet ./...
@touch bin/.vet

bin/.fmtcheck: bin/.generate $(go_files)
# Checking format of Go files...
@GOIMPORTS=$$(goimports -l $(go_files)) && \
if [ "$$GOIMPORTS" != "" ]; then \
goimports -d $(go_files); \
exit 1; \
fi
@touch bin/.fmtcheck

bin/.coverage.out: bin/.generate $(go_files)
@go test -cover -v -count=1 ./... -coverpkg=$(shell go list ${PACKAGE}/... | xargs | sed -e 's/ /,/g') -coverprofile bin/.coverage.tmp
@mv bin/.coverage.tmp bin/.coverage.out

coverage: bin/.coverage.out
@go tool cover -html=bin/.coverage.out

all: bin/.coverage.out bin/.fmtcheck
ci: lint test
Loading