forked from pmorch/c4viz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
103 lines (97 loc) · 3 KB
/
Taskfile.yml
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
# https://taskfile.dev
version: '3'
vars:
FE_PORT: 3000
BE_PORT: 9000
env:
C4VIZ_CACHE: /tmp/c4vizCache
C4VIZ_SOURCE: big-bank-plc.dsl
C4VIZ_SOURCE_DIR:
sh: echo $PWD/sourceDir
tasks:
default:
desc: By default run the serve-backend task that exposes the complete application
deps:
- serve-backend
build-backend:
desc: Build the backend
cmds:
- ./gradlew build
dir: backend
run: once
build-backend-no-npm:
desc: Build the backend without building the frontend with npm (is quicker)
cmds:
- ./gradlew build
dir: backend
env:
SKIP_NPM: 1
build-frontend:
desc: Build the frontend with npm
cmds:
- npm install
- npm run build
dir: frontend
env:
SKIP_NPM: 1
serve-backend:
desc: Run the backend on port {{ .BE_PORT }} (without the frontend)
deps:
- build-backend
cmds:
- "echo testing that dir exists: $C4VIZ_SOURCE_DIR"
- test -d $C4VIZ_SOURCE_DIR
- test -d $C4VIZ_CACHE || mkdir $C4VIZ_CACHE
- java -jar backend/build/libs/c4viz-${projversion}.jar
env:
SERVER_PORT: "{{ .BE_PORT }}"
projversion:
sh: cd backend && ./gradlew properties -q | grep "version:" | awk '{print $2}'
serve-frontend:
desc: Run the frontend serving on port {{ .FE_PORT }}
cmds:
- npm run serve -- --port {{ .FE_PORT }}
dir: frontend
docker-build:
desc: Builds the docker image
deps:
- build-backend
cmds:
- echo Building docker image pmorch/c4viz:latest
- docker build --build-arg version=$projversion -t pmorch/c4viz:latest .
env:
projversion:
sh: cd backend && ./gradlew properties -q | grep "version:" | awk '{print $2}'
dir: backend
run: once
release-latest:
deps:
- docker-build
cmds:
- echo Release docker image pmorch/c4viz:latest
- docker push pmorch/c4viz:latest
release:
deps:
- docker-build
cmds:
- echo Attempting to release version $projversion
# Test that the git tag doesn't exist already
- bash -c "! git show $projversion > /dev/null 2>&1"
# Test that the docker tag doesn't exist already
- bash -c "! docker pull pmorch/c4viz:$projversion > /dev/null 2>&1"
- git tag $projversion
- git push origin $projversion
- docker tag pmorch/c4viz:latest pmorch/c4viz:$projversion
- docker push pmorch/c4viz:$projversion
env:
projversion:
sh: cd backend && ./gradlew properties -q | grep "version:" | awk '{print $2}'
release-multi-platform:
cmds:
- echo Attempting to release version $projversion for x86 and arm64
- docker buildx create --use --name mybuilder
- docker buildx build --platform linux/amd64,linux/arm64 -t gramax/gramax-c4-server:latest -t gramax/gramax-c4-server:$projversion --build-arg version=$projversion --push .
- docker buildx rm mybuilder
env:
projversion:
sh: cd backend && ./gradlew properties -q | grep "version:" | awk '{print $2}'