Skip to content
Merged
Changes from all 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
39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
.PHONY: test lint cover mock_wire mock_gen swag migrate_local
.PHONY: test lint cover mock_wire mock_gen swag db_migrate db_rollback test_all lint_all

GO_TAGS := $(GO_TAGS)

build:
go build -o ./bin/csghub-server ./cmd/csghub-server
go build -tags "$(GO_TAGS)" -o ./bin/csghub-server ./cmd/csghub-server

test:
go test ./...
go test -tags "$(GO_TAGS)" ./...

test_all:
$(MAKE) test GO_TAGS=ce
$(MAKE) test GO_TAGS=ee
$(MAKE) test GO_TAGS=saas

lint:
golangci-lint run
golangci-lint run --build-tags "$(GO_TAGS)"

lint_all:
$(MAKE) lint GO_TAGS=ce
$(MAKE) lint GO_TAGS=ee
$(MAKE) lint GO_TAGS=saas

cover:
go test -coverprofile=cover.out ./...
go test -tags "$(GO_TAGS)" -coverprofile=cover.out ./...
go tool cover -html=cover.out -o cover.html
open cover.html

Expand All @@ -27,19 +39,22 @@ mock_wire:
fi

mock_gen:
mockery
mockery --tags "$(GO_TAGS)"

swag:
swag init --pd -d cmd/csghub-server/cmd/start,api/router,api/handler,builder/store/database,common/types,accounting/handler,user/handler,moderation/handler,component,dataviewer/handler,aigateway/handler,aigateway/types,notification/handler -g server.go

migrate_local:
go run cmd/csghub-server/main.go migration migrate --config local.toml

db_migrate:
@go run cmd/csghub-server/main.go migration migrate --config local.toml
@go run -tags "$(GO_TAGS)" cmd/csghub-server/main.go migration migrate --config local.toml

db_rollback:
@go run cmd/csghub-server/main.go migration rollback --config local.toml
@go run -tags "$(GO_TAGS)" cmd/csghub-server/main.go migration rollback --config local.toml

start_server:
@go run -tags "$(GO_TAGS)" cmd/csghub-server/main.go start server -l Info -f json --config local.toml

start_user:
@go run -tags "$(GO_TAGS)" cmd/csghub-server/main.go user launch -l Info -f json --config local.toml

error_doc:
@go run cmd/csghub-server/main.go errorx doc-gen
Expand All @@ -48,4 +63,4 @@ error_scan:
@go run cmd/csghub-server/main.go errorx scan --dir $(dir) -v

notify_gen:
@go run cmd/csghub-server/main.go notification notify-gen -l Info
@go run cmd/csghub-server/main.go notification notify-gen -l Info
Loading