Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
37 changes: 37 additions & 0 deletions .github/workflows/api-lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: API Lint & Test
on:
pull_request:
paths:
- 'api/**'

permissions:
contents: read

jobs:
api-v1:
name: api/v1
runs-on: ubuntu-latest
defaults:
run:
working-directory: api/v1
steps:
- uses: actions/checkout@v4
- uses: buildjet/setup-go@v5
with:
go-version: 1.25.x
- run: make lint
- run: make test

api-plugin:
name: api/plugin
runs-on: ubuntu-latest
defaults:
run:
working-directory: api/plugin
steps:
- uses: actions/checkout@v4
- uses: buildjet/setup-go@v5
with:
go-version: 1.25.x
- run: make lint
- run: make test
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ gen-schemas:
go mod edit -module=github.com/flanksource/config-db/hack/generate-schemas && \
go mod edit -require=github.com/flanksource/config-db@v1.0.0 && \
go mod edit -replace=github.com/flanksource/config-db=../../ && \
go mod edit -replace=github.com/flanksource/config-db/api=../../api/v1 && \
go mod edit -replace=github.com/flanksource/config-db/api/plugin=../../api/plugin && \
if grep -v "^//" ../../go.mod | grep -q "replace.*github.com/flanksource/duty.*=>"; then \
go mod edit -replace=github.com/flanksource/duty=../../../duty; \
fi && \
Expand Down
2 changes: 1 addition & 1 deletion analyzers/patches.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

"github.com/flanksource/commons/logger"
v1 "github.com/flanksource/config-db/api/v1"
v1 "github.com/flanksource/config-db/api"
)

// PatchAnalyzer ...
Expand Down
45 changes: 45 additions & 0 deletions api/plugin/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
LOCALBIN ?= $(shell pwd)/.bin
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint

GOLANGCI_LINT_VERSION ?= v2.7.2

$(LOCALBIN):
mkdir -p $(LOCALBIN)

.PHONY: tidy
tidy:
go mod tidy

.PHONY: fmt
fmt:
go fmt ./...

.PHONY: vet
vet:
go vet ./...

.PHONY: test
test:
go test -v ./...

.PHONY: build
build:
go build ./...

.PHONY: lint
lint: golangci-lint
$(GOLANGCI_LINT) run -v ./...

.PHONY: proto
proto:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/scraper.proto

.PHONY: generate
generate: proto

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(LOCALBIN)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
Loading
Loading