2023-02-23 17:03:20 +01:00
|
|
|
.PHONY: prebuild clean cleanall ci generate modd-precheck templates-archive
|
2020-12-16 11:20:11 -08:00
|
|
|
|
2021-01-26 10:48:32 -08:00
|
|
|
PACKAGE_FOLDER = focalboard
|
2020-10-08 09:21:27 -07:00
|
|
|
|
2021-01-19 14:10:14 -08:00
|
|
|
# Build Flags
|
|
|
|
BUILD_NUMBER ?= $(BUILD_NUMBER:)
|
|
|
|
BUILD_DATE = $(shell date -u)
|
|
|
|
BUILD_HASH = $(shell git rev-parse HEAD)
|
|
|
|
# If we don't set the build number it defaults to dev
|
|
|
|
ifeq ($(BUILD_NUMBER),)
|
|
|
|
BUILD_NUMBER := dev
|
2021-09-21 18:51:04 +02:00
|
|
|
BUILD_DATE := n/a
|
2021-01-19 14:10:14 -08:00
|
|
|
endif
|
|
|
|
|
2021-01-26 14:13:46 -08:00
|
|
|
LDFLAGS += -X "github.com/mattermost/focalboard/server/model.BuildNumber=$(BUILD_NUMBER)"
|
|
|
|
LDFLAGS += -X "github.com/mattermost/focalboard/server/model.BuildDate=$(BUILD_DATE)"
|
|
|
|
LDFLAGS += -X "github.com/mattermost/focalboard/server/model.BuildHash=$(BUILD_HASH)"
|
2021-01-19 14:10:14 -08:00
|
|
|
|
2022-06-29 19:48:05 +05:30
|
|
|
RACE = -race
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
RACE := ''
|
|
|
|
endif
|
|
|
|
|
2022-01-25 09:42:56 +00:00
|
|
|
# MAC cpu architecture
|
|
|
|
ifeq ($(shell uname -m),arm64)
|
|
|
|
MAC_GO_ARCH := arm64
|
|
|
|
else
|
|
|
|
MAC_GO_ARCH := amd64
|
|
|
|
endif
|
|
|
|
|
2023-02-23 17:03:20 +01:00
|
|
|
all: ci ## Simulate CI, locally.
|
2020-10-08 09:21:27 -07:00
|
|
|
|
2022-07-13 01:28:13 -05:00
|
|
|
ci: webapp-ci server-test ## Simulate CI, locally.
|
2021-01-20 09:55:36 -08:00
|
|
|
|
2022-08-03 17:40:25 -04:00
|
|
|
setup-go-work: export EXCLUDE_ENTERPRISE ?= true
|
2022-07-18 19:21:57 +02:00
|
|
|
setup-go-work: ## Sets up a go.work file
|
2022-08-02 19:02:35 -04:00
|
|
|
go run ./build/gowork/main.go
|
2022-07-18 19:21:57 +02:00
|
|
|
|
|
|
|
templates-archive: setup-go-work ## Build templates archive file
|
2022-04-13 15:36:20 -07:00
|
|
|
cd server/assets/build-template-archive; go run -tags '$(BUILD_TAGS)' main.go --dir="../templates-boardarchive" --out="../templates.boardarchive"
|
2022-03-30 18:10:11 -04:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
generate: ## Install and run code generators.
|
2022-09-09 20:56:44 -05:00
|
|
|
cd server; go install github.com/golang/mock/mockgen@v1.6.0
|
2020-10-18 01:17:17 +02:00
|
|
|
cd server; go generate ./...
|
|
|
|
|
2022-10-11 21:09:52 -04:00
|
|
|
server-lint: setup-go-work ## Run linters on server code.
|
2020-10-21 09:59:02 +02:00
|
|
|
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
|
2022-08-25 00:08:58 +02:00
|
|
|
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install-golangci-lint for installation instructions."; \
|
2021-02-10 10:13:04 -08:00
|
|
|
exit 1; \
|
2021-07-30 13:32:02 +02:00
|
|
|
fi;
|
2021-06-24 10:28:01 +05:30
|
|
|
cd server; golangci-lint run ./...
|
2020-10-21 09:59:02 +02:00
|
|
|
|
2021-09-22 15:40:04 +02:00
|
|
|
modd-precheck:
|
|
|
|
@if ! [ -x "$$(command -v modd)" ]; then \
|
|
|
|
echo "modd is not installed. Please see https://github.com/cortesi/modd#install for installation instructions"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
|
2023-02-23 18:02:58 +01:00
|
|
|
server-test: server-test-mysql server-test-mariadb server-test-postgres ## Run server tests
|
2022-04-13 15:36:20 -07:00
|
|
|
|
2022-05-05 15:49:34 -04:00
|
|
|
server-test-mysql: export FOCALBOARD_UNIT_TESTING=1
|
|
|
|
server-test-mysql: export FOCALBOARD_STORE_TEST_DB_TYPE=mysql
|
2022-12-16 11:15:38 -05:00
|
|
|
server-test-mysql: export FOCALBOARD_STORE_TEST_DOCKER_PORT=44446
|
2021-12-17 12:30:47 -05:00
|
|
|
|
2022-10-11 21:09:52 -04:00
|
|
|
server-test-mysql: setup-go-work ## Run server tests using mysql
|
2021-12-17 12:30:47 -05:00
|
|
|
@echo Starting docker container for mysql
|
2022-03-22 15:24:34 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
2021-12-17 12:30:47 -05:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-mysql.yml run start_dependencies
|
2022-04-22 15:57:35 -07:00
|
|
|
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-mysql-profile.coverage -count=1 -timeout=30m ./...
|
|
|
|
cd server; go tool cover -func server-mysql-profile.coverage
|
2022-01-25 09:42:56 +00:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
2021-12-17 12:30:47 -05:00
|
|
|
|
2022-10-20 15:36:13 +02:00
|
|
|
server-test-mariadb: export FOCALBOARD_UNIT_TESTING=1
|
|
|
|
server-test-mariadb: export FOCALBOARD_STORE_TEST_DB_TYPE=mariadb
|
|
|
|
server-test-mariadb: export FOCALBOARD_STORE_TEST_DOCKER_PORT=44445
|
|
|
|
|
|
|
|
server-test-mariadb: templates-archive ## Run server tests using mysql
|
|
|
|
@echo Starting docker container for mariadb
|
|
|
|
docker-compose -f ./docker-testing/docker-compose-mariadb.yml down -v --remove-orphans
|
|
|
|
docker-compose -f ./docker-testing/docker-compose-mariadb.yml run start_dependencies
|
|
|
|
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-mariadb-profile.coverage -count=1 -timeout=30m ./...
|
|
|
|
cd server; go tool cover -func server-mariadb-profile.coverage
|
|
|
|
docker-compose -f ./docker-testing/docker-compose-mariadb.yml down -v --remove-orphans
|
|
|
|
|
2022-05-05 15:49:34 -04:00
|
|
|
server-test-postgres: export FOCALBOARD_UNIT_TESTING=1
|
|
|
|
server-test-postgres: export FOCALBOARD_STORE_TEST_DB_TYPE=postgres
|
2022-12-16 11:15:38 -05:00
|
|
|
server-test-postgres: export FOCALBOARD_STORE_TEST_DOCKER_PORT=44447
|
2021-12-17 12:30:47 -05:00
|
|
|
|
2022-10-11 21:09:52 -04:00
|
|
|
server-test-postgres: setup-go-work ## Run server tests using postgres
|
2021-12-17 12:30:47 -05:00
|
|
|
@echo Starting docker container for postgres
|
2022-03-22 15:24:34 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans
|
2021-12-17 12:30:47 -05:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-postgres.yml run start_dependencies
|
2022-04-22 15:57:35 -07:00
|
|
|
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-postgres-profile.coverage -count=1 -timeout=30m ./...
|
|
|
|
cd server; go tool cover -func server-postgres-profile.coverage
|
2022-01-25 09:42:56 +00:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans
|
2021-12-17 12:30:47 -05:00
|
|
|
|
2022-07-13 01:28:13 -05:00
|
|
|
webapp-ci: ## Webapp CI: linting & testing.
|
|
|
|
cd webapp; npm run check
|
|
|
|
cd mattermost-plugin/webapp; npm run lint
|
|
|
|
cd webapp; npm run test
|
|
|
|
cd mattermost-plugin/webapp; npm run test
|
2023-02-23 17:03:20 +01:00
|
|
|
# ToDo: reenable e2e tests when available in product-mode
|
|
|
|
# cd webapp; npm run cypress:ci
|
2022-07-13 01:28:13 -05:00
|
|
|
|
2022-02-07 10:41:07 -05:00
|
|
|
webapp-test: ## jest tests for webapp
|
|
|
|
cd webapp; npm run test
|
|
|
|
|
2021-09-22 17:08:24 +02:00
|
|
|
watch-plugin: modd-precheck ## Run and upload the plugin to a development server
|
2022-03-22 15:24:34 +01:00
|
|
|
env FOCALBOARD_BUILD_TAGS='$(BUILD_TAGS)' modd -f modd-watchplugin.conf
|
2021-09-22 17:08:24 +02:00
|
|
|
|
2021-10-04 10:06:54 +02:00
|
|
|
live-watch-plugin: modd-precheck ## Run and update locally the plugin in the development server
|
|
|
|
cd mattermost-plugin; make live-watch
|
|
|
|
|
2022-10-13 16:56:59 -04:00
|
|
|
.PHONY: build-product
|
|
|
|
build-product: ## Builds the product as something the Mattermost server will pull files from when packaging a release
|
|
|
|
cd mattermost-plugin; make build-product
|
|
|
|
|
2022-09-07 15:03:14 -04:00
|
|
|
.PHONY: watch-product
|
2022-08-17 16:13:35 -04:00
|
|
|
watch-product: ## Run the product as something the Mattermost web app will watch for
|
|
|
|
cd mattermost-plugin; make watch-product
|
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
swagger: ## Generate swagger API spec and clients based on it.
|
2021-02-17 11:29:20 -08:00
|
|
|
mkdir -p server/swagger/docs
|
|
|
|
mkdir -p server/swagger/clients
|
|
|
|
cd server && swagger generate spec -m -o ./swagger/swagger.yml
|
|
|
|
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g html2 -o docs/html
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g go -o clients/go
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g javascript -o clients/javascript
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g typescript-fetch -o clients/typescript
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g swift5 -o clients/swift
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g python -o clients/python
|
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
clean: ## Clean build artifacts.
|
2020-10-20 11:48:22 -07:00
|
|
|
rm -rf webapp/pack
|
2020-10-08 09:21:27 -07:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
cleanall: clean ## Clean all build artifacts and dependencies.
|
2020-10-20 11:48:22 -07:00
|
|
|
rm -rf webapp/node_modules
|
2021-07-30 13:32:02 +02:00
|
|
|
|
|
|
|
## Help documentatin à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
|
|
|
help:
|
|
|
|
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|