diff --git a/.github/workflows/label-conflcts.yaml b/.github/workflows/label-conflcts.yaml index 3d101aa23..5aa22a8f5 100644 --- a/.github/workflows/label-conflcts.yaml +++ b/.github/workflows/label-conflcts.yaml @@ -12,4 +12,4 @@ jobs: CONFLICT_LABEL_NAME: 'has conflicts' GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MAX_RETRIES: 5 - WAIT_MS: 5000 + WAIT_MS: 10000 diff --git a/Makefile b/Makefile index a3d4f1b28..68556eb23 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,20 @@ PLATFORM=$(shell go env GOOS) ARCH=$(shell go env GOARCH) -TAG=latest -SWAG_VERSION=v1.8.11 - # build target, can be one of "production", "testing", "development" ENV=development WEBPACK_CONFIG=webpack/webpack.$(ENV).js +TAG=latest + +SWAG=go run github.com/swaggo/swag/cmd/swag@v1.8.11 +GOTESTSUM=go run gotest.tools/gotestsum@latest + +# Don't change anything below unless you know what you're doing .DEFAULT_GOAL := help -.PHONY: help build-storybook build-client devops download-binaries tidy clean client-deps - ##@ Building - +.PHONY: init-dist build-storybook build build-client build-server build-image devops init-dist: @mkdir -p dist @@ -31,7 +32,7 @@ build-client: init-dist client-deps ## Build the client build-server: init-dist ## Build the server binary ./build/build_binary.sh "$(PLATFORM)" "$(ARCH)" -build-image: build ## Build the Portainer image +build-image: deps build ## Build the Portainer image locally docker buildx build --load -t portainerci/portainer:$(TAG) -f build/linux/Dockerfile . devops: clean init-dist download-binaries build-client ## Build the server binary for CI @@ -39,42 +40,52 @@ devops: clean init-dist download-binaries build-client ## Build the server binar @./build/build_binary_azuredevops.sh "$(PLATFORM)" "$(ARCH)" ##@ Dependencies +.PHONY: deps download-binaries client-deps tidy +deps: download-binaries client-deps ## Download all build and client dependancies download-binaries: ## Download dependant binaries @./build/download_binaries.sh $(PLATFORM) $(ARCH) -tidy: ## Tidy up the go.mod file - cd api && go mod tidy - client-deps: ## Install client dependencies yarn -##@ Cleanup +tidy: ## Tidy up the go.mod file + cd api && go mod tidy + +##@ Cleanup +.PHONY: clean clean: ## Remove all build and download artifacts @echo "Clearing the dist directory..." @rm -rf dist/* ##@ Testing +.PHONY: test test-client test-server +test: test-server test-client ## Run all tests test-client: ## Run client tests yarn test test-server: ## Run server tests - cd api && go test -v ./... - -test: test-client test-server ## Run all tests + cd api && $(GOTESTSUM) --format pkgname-and-test-fails --format-hide-empty-pkg --hide-summary skipped -- -cover ./... ##@ Dev +.PHONY: dev dev-client dev-server +dev: ## Run both the client and server in development mode + make dev-server + make dev-client dev-client: ## Run the client in development mode yarn dev -dev-server: build-image ## Run the server in development mode +dev-server: ## Run the server in development mode @./dev/run_container.sh ##@ Format +.PHONY: format format-client format-server + +format: format-client format-server ## Format all code format-client: ## Format client code yarn format @@ -82,10 +93,8 @@ format-client: ## Format client code format-server: ## Format server code cd api && go fmt ./... -format: format-client format-server ## Format all code - ##@ Lint - +.PHONY: lint lint-client lint-server lint: lint-client lint-server ## Lint all code lint-client: ## Lint client code @@ -95,17 +104,14 @@ lint-server: ## Lint server code cd api && go vet ./... ##@ Extension - +.PHONY: dev-extension dev-extension: build-server build-client ## Run the extension in development mode make local -f build/docker-extension/Makefile ##@ Docs - -docs-deps: ## Install docs dependencies - go install github.com/swaggo/swag/cmd/swag@$(SWAG_VERSION) - -docs-build: docs-deps ## Build docs - cd api && swag init -g ./http/handler/handler.go --parseDependency --parseInternal --parseDepth 2 --markdownFiles ./ +.PHONY: docs-build docs-validate docs-clean docs-validate-clean +docs-build: ## Build docs + cd api && $(SWAG) init -g ./http/handler/handler.go --parseDependency --parseInternal --parseDepth 2 --markdownFiles ./ docs-validate: docs-build ## Validate docs yarn swagger2openapi --warnOnly api/docs/swagger.yaml -o api/docs/openapi.yaml @@ -117,6 +123,6 @@ docs-clean: ## Clean docs docs-validate-clean: docs-validate docs-clean ## Validate and clean docs ##@ Helpers - +.PHONY: help help: ## Display this help - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + @awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) diff --git a/api/internal/maps/maps_test.go b/api/internal/maps/maps_test.go index 16db64072..41a6992f9 100644 --- a/api/internal/maps/maps_test.go +++ b/api/internal/maps/maps_test.go @@ -18,7 +18,7 @@ func TestGet(t *testing.T) { return } result := Get(data, "data.yesterday", "sunrise") - fmt.Printf("result: %s", result) + fmt.Printf("result: %s\n", result) expected := "06:19" assert.Equal(t, expected, result) }) @@ -31,7 +31,7 @@ func TestGet(t *testing.T) { return } result := Get(data, "data.yesterday", "sunrise") - fmt.Printf("result: %s", result) + fmt.Printf("result: %s\n", result) expected := "" assert.Equal(t, expected, result) })