Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use infra-checkers static analysis settings and bump go to 1.18 #333

Merged
merged 2 commits into from Aug 23, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/push_pr.yml
Expand Up @@ -57,7 +57,7 @@ jobs:
- uses: actions/setup-go@v3
if: steps.list-changed.outputs.changed == 'true'
with:
go-version: '1.18'
go-version: ${{ env.GO_VERSION }}
- name: Create image for chart testing
if: steps.list-changed.outputs.changed == 'true'
run: |
Expand All @@ -78,13 +78,18 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
sigilioso marked this conversation as resolved.
Show resolved Hide resolved
with:
go-version: ${{ env.GO_VERSION }}
- uses: newrelic/newrelic-infra-checkers@v1
with:
golangci-lint-config: golangci-lint-limited
- name: Semgrep
uses: returntocorp/semgrep-action@v1
with:
auditOn: push
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.1.0
uses: golangci/golangci-lint-action@v3
continue-on-error: ${{ github.event_name != 'pull_request' }}
with:
only-new-issues: true
Expand Down
29 changes: 0 additions & 29 deletions .golangci.yml

This file was deleted.

28 changes: 8 additions & 20 deletions Makefile
Expand Up @@ -7,26 +7,14 @@ GO_FILES := ./
BIN_FILES := ./cmd/nri-prometheus/
TARGET := target
GOFLAGS = -mod=readonly
GOLANGCI_LINT = github.com/golangci/golangci-lint/cmd/golangci-lint

all: build

build: clean validate compile test
build: clean compile test

clean:
@echo "=== $(INTEGRATION) === [ clean ]: removing binaries and coverage file..."
@rm -rfv bin coverage.xml $(TARGET)


$(GOLANGCI_LINT_BIN):
@echo "installing GolangCI version $(GOLANGCI_LINT_VERSION)"
@(curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION))

validate:
@printf "=== $(INTEGRATION) === [ validate ]: running golangci-lint & semgrep... "
@go run -modfile=tools/go.mod $(GOFLAGS) $(GOLANGCI_LINT) run --verbose
@[ -f .semgrep.yml ] && semgrep_config=".semgrep.yml" || semgrep_config="p/golang" ; \
docker run --rm -v "${PWD}:/src:ro" --workdir /src returntocorp/semgrep -c "$$semgrep_config"
@echo "=== $(INTEGRATION) === [ clean ]: removing binaries..."
@rm -rfv bin $(TARGET)

compile-deps:
@echo "=== $(INTEGRATION) === [ compile-deps ]: installing build dependencies..."
Expand All @@ -42,13 +30,13 @@ clean-test:
@echo "=== $(INTEGRATION) === [ compile ]: cleanup test dependencies..."
@go mod tidy

test-deps: compile-deps
@echo "=== $(INTEGRATION) === [ test-deps ]: installing testing dependencies..."
@go get -v $(TEST_DEPS)

test-only:
@echo "=== $(INTEGRATION) === [ test ]: running unit tests..."
@go test ./...

test: test-only clean-test

install: bin/$(BINARY_NAME)
@echo "=== $(INTEGRATION) === [ install ]: installing bin/$(BINARY_NAME)..."
@sudo install -D --mode=755 --owner=root --strip $(ROOT)bin/$(BINARY_NAME) $(INTEGRATIONS_DIR)/bin/$(BINARY_NAME)
@sudo install -D --mode=644 --owner=root $(ROOT)$(INTEGRATION)-definition.yml $(INTEGRATIONS_DIR)/$(INTEGRATION)-definition.yml
Expand All @@ -58,4 +46,4 @@ install: bin/$(BINARY_NAME)
include $(CURDIR)/build/ci.mk
include $(CURDIR)/build/release.mk

.PHONY: all build clean validate compile-deps compile test-only test install
.PHONY: all build clean compile-deps compile test install
158 changes: 0 additions & 158 deletions tools/go.mod

This file was deleted.