Skip to content

Commit

Permalink
#8 Installed tools via makefile, merged tests with the lint yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Dec 19, 2023
1 parent 9a92375 commit e0cd143
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 25 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
name: Static Checks
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [lint, build]
steps:
- uses: actions/checkout@v3
- name: Set up Go
Expand All @@ -84,3 +83,18 @@ jobs:

- name: Nilaway
run: nilaway ./...

tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true

- name: Test
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...
21 changes: 0 additions & 21 deletions .github/workflows/tests.yaml

This file was deleted.

9 changes: 8 additions & 1 deletion .github/workflows/vuln.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
name: Vulnerability Check
runs-on: ubuntu-latest
timeout-minutes: 5
env:
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v4
Expand All @@ -28,5 +30,10 @@ jobs:
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run govulncheck
- name: Govulncheck
run: govulncheck -test ./...

- name: Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./...
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ linters:
enable:
- nolintlint
- revive
- staticcheck

linters-settings:
govet:
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,33 @@ help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'


install: ## Install static checkers
install-checkers: ## Install static checkers
@echo "🚚 Downloading binaries.."
@GOBIN=$(CHECKER_BIN) go install mvdan.cc/gofumpt@latest
@GOBIN=$(CHECKER_BIN) go install go.uber.org/nilaway/cmd/nilaway@latest
@GOBIN=$(CHECKER_BIN) go install golang.org/x/vuln/cmd/govulncheck@latest
@GOBIN=$(CHECKER_BIN) go install github.com/securego/gosec/v2/cmd/gosec@latest

lint: ## Lint the source code
lint: install-checkers ## Lint the source code
@echo "🧹 Formatting files.."
@go fmt ./...
@$(CHECKER_BIN)/gofumpt -l -w .
@echo "🧹 Vetting go.mod.."
@go vet ./...
@echo "🧹 Cleaning go.mod.."
@go mod tidy


static-checks: install-checkers ## Static Analysis
@echo "🧹 GoCI Lint.."
@golangci-lint run ./...
@echo "🧹 Nilaway.."
@$(CHECKER_BIN)/nilaway ./...

vuln: install-checkers ## Check for vulnerabilities
@echo "🔍 Checking for vulnerabilities"
@$(CHECKER_BIN)/govulncheck -test ./...
@$(CHECKER_BIN)/gosec -quiet -exclude=G104 ./...

run: ## Run Glide
@go run -ldflags $(LDFLAGS_COMMON) main.go
Expand Down

0 comments on commit e0cd143

Please sign in to comment.