Skip to content

Commit

Permalink
Merge branch 'main' into SI-2866-device-last-seen-b
Browse files Browse the repository at this point in the history
  • Loading branch information
Allyson-English committed Aug 13, 2024
2 parents b5256fc + ead824a commit 5705fd3
Show file tree
Hide file tree
Showing 16 changed files with 495 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: make tools

- name: generate graphql files
run: make gql
run: make generate

- name: porcelain
shell: bash
Expand Down
36 changes: 24 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,36 @@ VER_CUT := $(shell echo $(VERSION) | cut -c2-)
GOLANGCI_VERSION = v1.56.2
GQLGEN_VERSION = $(shell go list -m -f '{{.Version}}' github.com/99designs/gqlgen)
MODEL_GARAGE_VERSION = $(shell go list -m -f '{{.Version}}' github.com/DIMO-Network/model-garage)
MOCKGEN_VERSION = $(shell go list -m -f '{{.Version}}' go.uber.org/mock)

help:
@echo "\nSpecify a subcommand:\n"
@grep -hE '^[0-9a-zA-Z_-]+:.*?## .*$$' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-20s\033[m %s\n", $$1, $$2}'
@echo ""

build:
build: ## Build the binary
@CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) \
go build -o $(PATHINSTBIN)/$(BIN_NAME) ./cmd/$(BIN_NAME)

run: build
run: build ## Run the binary
@./$(PATHINSTBIN)/$(BIN_NAME)
all: clean target

clean:
clean: ## Remove previous built binaries
@rm -rf $(PATHINSTBIN)

install: build
install: build
@install -d $(INSTALL_DIR)
@rm -f $(INSTALL_DIR)/$(BIN_NAME)
@cp $(PATHINSTBIN)/$(BIN_NAME) $(INSTALL_DIR)/$(BIN_NAME)

tidy:
tidy: ## tidy go modules
@go mod tidy

test:
test: ## Run tests
@go test -v ./...

lint:
lint: ## Run linter
@golangci-lint run

format:
Expand All @@ -63,18 +68,25 @@ gql-model: ## Generate gqlgen data model.
@codegen -output=internal/graph/model -generators=custom -custom.output-file=signalSetter_gen.go -custom.template-file=./internal/graph/model/signalSetter.tmpl -custom.format=true
@codegen -output=internal/graph -generators=custom -custom.output-file=signals_gen.resolvers.go -custom.template-file=./internal/graph/signals_gen.resolvers.tmpl -custom.format=true

gql: gql-model gqlgen
gql: gql-model gqlgen ## Generate all gql code.

tools-gqlgen:
generate: gql ## Runs all code generators for the repository.
@go generate ./...

tools-gqlgen: ## install gqlgen tool
@mkdir -p $(PATHINSTBIN)
GOBIN=$(PATHINSTBIN) go install github.com/99designs/gqlgen@${GQLGEN_VERSION}

tools-model-garage:
tools-model-garage: ## install model-garage tool
@mkdir -p $(PATHINSTBIN)
GOBIN=$(PATHINSTBIN) go install github.com/DIMO-Network/model-garage/cmd/codegen@${MODEL_GARAGE_VERSION}

tools-golangci-lint:
tools-golangci-lint: ## install golangci-lint tool
@mkdir -p $(PATHINSTBIN)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PATHINSTBIN) $(GOLANGCI_VERSION)

tools: tools-golangci-lint tools-gqlgen tools-model-garage
tools-mockgen: ## install mockgen tool
@mkdir -p $(PATHINSTBIN)
GOBIN=$(PATHINSTBIN) go install go.uber.org/mock/mockgen@$(MOCKGEN_VERSION)

tools: tools-golangci-lint tools-gqlgen tools-model-garage tools-mockgen ## Install all tools required for development.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ Run `make` to see some helpful sub-commands:
Specify a subcommand:
`build` Compile the Go code and output the binary to the `bin/` directory.
`run` Build the project (if not already built) and run the binary.
`clean` Remove the `bin/` directory.
`install` Build the project and copy the binary to the `INSTALL_DIR`.
`test` Run tests.
`lint` Lint the project.
`format` Format the project.
`docker` Build a Docker image of the project.
`gqlgen` Generate gqlgen code.
`gql-model` Generate gqlgen data model.
`gql` Generate gqlgen code and data model.
`tools` Install `golangci-lint`, `gqlgen`, and `model-garage`.
build Build the binary
run Run the binary
clean Remove previous built binaries
tidy tidy go modules
test Run tests
lint Run linter
gqlgen Generate gqlgen code.
gql-model Generate gqlgen data model.
gql Generate all gql code.
generate Runs all code generators for the repository.
tools-gqlgen install gqlgen tool
tools-model-garage install model-garage tool
tools-golangci-lint install golangci-lint tool
tools-mockgen install mockgen tool
tools Install all tools required for development.
```

## License
Expand Down
2 changes: 1 addition & 1 deletion charts/telemetry-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ replicaCount: 1
image:
repository: dimozone/telemetry-api
pullPolicy: IfNotPresent
tag: bc97ef5
tag: '87e3260'
imagePullSecrets: []
nameOverride: ''
fullnameOverride: ''
Expand Down
5 changes: 4 additions & 1 deletion cmd/telemetry-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func main() {
if err != nil {
logger.Fatal().Err(err).Msg("Couldn't create ClickHouse service.")
}
baseRepo := repositories.NewRepository(&repoLogger, chService, settings.DeviceLastSeenBinHrs)
baseRepo, err := repositories.NewRepository(&repoLogger, chService, settings.DeviceLastSeenBinHrs)
if err != nil {
logger.Fatal().Err(err).Msg("Couldn't create base repository.")
}
vinvcRepo, err := newVinVCServiceFromSettings(settings, &logger)
if err != nil {
logger.Fatal().Err(err).Msg("Couldn't create VINVC repository.")
Expand Down
5 changes: 5 additions & 0 deletions internal/graph/base.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

183 changes: 178 additions & 5 deletions internal/graph/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5705fd3

Please sign in to comment.