2023-12-21 16:04:04 +00:00
|
|
|
BIN_DIR = $(shell pwd)/bin
|
2024-10-25 14:12:35 +00:00
|
|
|
WEB_DIR = $(shell pwd)/server/web
|
|
|
|
WEB_BUILD_DIR = $(shell pwd)/server/web/build
|
|
|
|
WEB_NODE_DIR = $(shell pwd)/server/web/node_modules
|
|
|
|
WEB_COVERAGE_DIR = $(shell pwd)/server/web/coverage
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-10-25 14:12:35 +00:00
|
|
|
# cleanup steps
|
|
|
|
clean: clean-server clean-web
|
|
|
|
clean-server:
|
2023-12-21 16:04:04 +00:00
|
|
|
rm -rf ${BIN_DIR}
|
2024-10-25 14:12:35 +00:00
|
|
|
clean-web:
|
|
|
|
rm -rf ${WEB_BUILD_DIR} ${WEB_NODE_DIR} ${WEB_COVERAGE_DIR}
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-10-25 14:12:35 +00:00
|
|
|
# dependencies steps
|
|
|
|
dependencies: dependencies-web dependencies-server
|
|
|
|
dependencies-server:
|
2023-12-21 16:04:04 +00:00
|
|
|
GO111MODULE=on go mod download
|
2024-10-25 14:12:35 +00:00
|
|
|
dependencies-web:
|
2024-12-21 14:11:13 +00:00
|
|
|
cd ${WEB_DIR}; pnpm install --frozen-lockfile
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-10-25 14:12:35 +00:00
|
|
|
# checkstyle steps
|
|
|
|
checkstyle: checkstyle-web checkstyle-server
|
|
|
|
checkstyle-server:
|
|
|
|
go vet ./...
|
|
|
|
checkstyle-web:
|
2024-12-10 20:01:37 +00:00
|
|
|
cd ${WEB_DIR}; pnpm run checkstyle
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-10-25 14:12:35 +00:00
|
|
|
# test steps
|
|
|
|
test: test-web test-server
|
|
|
|
test-server:
|
|
|
|
go test -race ./...
|
|
|
|
test-web:
|
2024-12-10 20:01:37 +00:00
|
|
|
cd ${WEB_DIR}; pnpm run test:ci
|
2024-10-25 14:12:35 +00:00
|
|
|
|
|
|
|
# build steps
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-12-21 14:11:13 +00:00
|
|
|
build-server-all: build-server-freebsd-amd64 build-server-freebsd-arm64 build-server-darwin-amd64 build-server-darwin-arm64 build-server-linux-amd64 build-server-linux-arm64 build-server-windows-amd64 build-server-windows-arm64
|
|
|
|
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-freebsd-amd64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-freebsd-amd64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-freebsd-arm64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-freebsd-arm64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-darwin-amd64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-darwin-amd64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-darwin-arm64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-darwin-arm64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-linux-amd64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-linux-amd64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-linux-arm64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-linux-arm64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-windows-amd64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-windows-amd64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-server-windows-arm64:
|
2024-12-21 14:11:13 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-windows-arm64 cmd/server/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
|
|
|
|
build-cli-all: build-cli-freebsd-amd64 build-cli-freebsd-arm64 build-cli-darwin-amd64 build-cli-darwin-arm64 build-cli-linux-amd64 build-cli-linux-arm64 build-cli-windows-amd64 build-cli-windows-arm64
|
|
|
|
|
|
|
|
build-cli-freebsd-amd64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-freebsd-amd64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-freebsd-arm64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-freebsd-arm64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-darwin-amd64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-darwin-amd64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-darwin-arm64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-darwin-arm64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-linux-amd64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-linux-amd64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-linux-arm64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-linux-arm64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-windows-amd64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-windows-amd64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
build-cli-windows-arm64:
|
2024-10-25 14:12:35 +00:00
|
|
|
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-windows-arm64 cmd/cli/main.go
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-10-25 14:12:35 +00:00
|
|
|
# remove built build/conf directory to be served live from the running binary
|
|
|
|
build-web:
|
2024-12-10 20:01:37 +00:00
|
|
|
cd ${WEB_DIR}; pnpm run build; rm -rf build/conf
|
2023-12-21 16:04:04 +00:00
|
|
|
|
2024-10-25 14:12:35 +00:00
|
|
|
# ci
|
|
|
|
clean-ci: clean
|
|
|
|
dependencies-ci: dependencies
|
2024-06-02 15:22:43 +00:00
|
|
|
checkstyle-ci: checkstyle
|
2024-10-25 14:12:35 +00:00
|
|
|
test-ci: test
|
2024-12-21 14:11:13 +00:00
|
|
|
build-server-ci: build-server-all
|
|
|
|
build-cli-ci: build-cli-all
|
2024-10-25 14:12:35 +00:00
|
|
|
build-web-ci: build-web
|
|
|
|
ci: clean-ci dependencies-ci checkstyle-ci test-ci build-web-ci build-server-ci build-cli-ci
|