-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (96 loc) · 4.19 KB
/
Makefile
File metadata and controls
117 lines (96 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
VERSION = $(shell head pom.xml | grep '<version>[0-9.]\+' | sed -E 's/<version>([0-9a-z.-]+)<\/version>/\1/' | tr -d '[:space:]')
DIST_TARGET = datashare-dist/target/datashare-dist-$(VERSION)-docker
DEVENV_PROPERTIES = datashare-devenv.properties
DEVENV_PROPERTIES_TEMPLATE = datashare-devenv.properties.template
MVN = mvn
.PHONY: help build dist install test run clean devenv migrate generate docker release app elasticsearch
help:
@echo "Datashare Makefile - Available targets:"
@echo ""
@echo " Development:"
@echo " devenv - Create development environment configuration file"
@echo " install - Install dependencies and build all modules"
@echo " build - Build distribution JARs (alias for 'dist')"
@echo " test - Run all tests"
@echo " run - Start Datashare (JDWP on port 8090 by default, requires 'build' first)"
@echo " clean - Clean all build artifacts"
@echo " app - Download and install frontend (uses VERSION from pom.xml)"
@echo " elasticsearch - Download and install Elasticsearch locally"
@echo ""
@echo " Database:"
@echo " migrate - Apply database migrations (Liquibase)"
@echo " generate - Generate jOOQ sources (run after schema changes)"
@echo " reset-db - Reset database and reapply migrations (DESTRUCTIVE)"
@echo ""
@echo " Release:"
@echo " release - Create a new release (requires NEW_VERSION=x.y.z)"
@echo " docker - Build Docker image"
@echo ""
## Create development environment configuration
devenv: $(DEVENV_PROPERTIES)
@echo "Development environment ready: $(DEVENV_PROPERTIES)"
$(DEVENV_PROPERTIES):
cp $(DEVENV_PROPERTIES_TEMPLATE) $(DEVENV_PROPERTIES)
## Install dependencies and build all modules
install: migrate
$(MVN) clean install -DskipTests -Dgpg.skip=true
## Build distribution JARs (alias for dist)
build: dist
## Build distribution package
dist: migrate
$(MVN) clean package -DskipTests
## Run all tests
test:
$(MVN) test
## Start Datashare locally
run:
./run.sh
## Download and install frontend from GitHub releases
app:
@./datashare-app/scripts/download-frontend.sh $(VERSION)
## Download and install Elasticsearch locally
elasticsearch:
@./datashare-dist/src/main/deb/bin/datashare-elasticsearch-setup.sh install
## Clean all build artifacts
clean:
$(MVN) clean
## Apply database migrations (uses dsbuild DB via postgresBuildUri)
migrate: devenv
$(MVN) -pl commons-test -am install -DskipTests -Dgpg.skip=true -q
$(MVN) -pl datashare-db initialize liquibase:update
## Generate sources from database schema (jOOQ)
generate: migrate
$(MVN) -pl datashare-db generate-sources
## Reset database and reapply all migrations (DESTRUCTIVE)
reset-db: devenv
bash datashare-db/scripts/reset-datashare-db.sh
$(MVN) -pl datashare-db initialize liquibase:update
## Create a new release (usage: make release NEW_VERSION=x.y.z)
release:
ifndef NEW_VERSION
$(error NEW_VERSION is required. Usage: make release NEW_VERSION=x.y.z)
endif
mvn versions:set -DnewVersion=$(NEW_VERSION)
git commit -am "[release] $(NEW_VERSION) [skip ci]"
git tag $(NEW_VERSION)
@echo "Release $(NEW_VERSION) created. Push with: git push origin main --tags"
## Create a module-specific release (usage: make release-api NEW_VERSION=x.y.z)
release-%:
ifndef NEW_VERSION
$(error NEW_VERSION is required. Usage: make release-$* NEW_VERSION=x.y.z)
endif
mvn -pl datashare-$* versions:set -DnewVersion=$(NEW_VERSION)
sed -i "s|<datashare\-$*.version>\([0-9.]\+\)<\/datashare\-$*.version>|<datashare\-$*.version>$(NEW_VERSION)<\/datashare\-$*.version>|g" pom.xml
git commit -am "[release] datashare-$*/$(NEW_VERSION) [skip ci]"
git tag datashare-$*/$(NEW_VERSION)
@echo "Release datashare-$*/$(NEW_VERSION) created. Push with: git push origin main --tags"
## Build Docker image
docker: $(DIST_TARGET)
docker build -t icij/datashare:$(VERSION) $(DIST_TARGET)
$(DIST_TARGET): dist
## Build Docker image
build-temporal-testcontainer:
ifndef NEW_VERSION
$(error NEW_VERSION is required. Usage: make build-temporal-testcontainer NEW_VERSION=x.y.z)
endif
docker buildx build --platform linux/amd64,linux/arm64 -t icij/datashare-temporal-testcontainer:$(NEW_VERSION) --target temporal-test-container --push .devcontainer