-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
142 lines (109 loc) · 5.14 KB
/
justfile
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
set shell := ["bash", "-uc"]
base-directory := justfile_directory()
_default:
@just --list --unsorted
###############################################################################
## Version
###############################################################################
version := `git tag --sort=v:refname | tail -1`
semver := base-directory / ".github/semver"
# Print version of the latest release
print-version:
@echo {{ version }}
# Print current development version
print-dev-version:
@echo "$({{ semver }} bump minor {{ version }})-dev"
bump-version scope="patch":
@echo "$({{ semver }} bump {{ scope }} {{ version }})"
###############################################################################
## Documentation
###############################################################################
docs-branch := "gh-pages"
docs-version := `tag=$(git tag --sort=v:refname | tail -1);echo ${tag%.*}`
docs-config := base-directory / "docs/mkdocs.yml"
# Serve current docs located in ./docs/docs
serve-docs port="8000":
mkdocs serve --config-file {{ docs-config }} --dev-addr localhost:{{ port }}
# Serve docs deployed in branch 'documentation'
serve-deployed-docs port="8000":
mike serve --config-file {{ docs-config }} --dev-addr localhost:{{ port }}
# Print the current version of the documentation
print-docs-version:
@echo {{ docs-version }}
# Print current dev version of the documentation
print-docs-dev-version:
#!/usr/bin/env bash
new_version=$({{base-directory }}/.github/semver bump minor {{ version }})
docs_version=$(echo ${new_version%.*})
echo "$docs_version-dev"
docs-set-quick-version new-version:
sed -i "s/quick_version:.*$/quick_version: {{ new-version }}/" {{ docs-config }}
###############################################################################
## Docker Push
###############################################################################
gradle-bin := base-directory / "gradlew"
# Print the image tag for the current branch
get-branch-image:
#!/usr/bin/env bash
ref=$(git branch --show-current)
# Substitute '/' with '-'
echo "${ref////-}"
# Push image for current branch for <project>
push-image project:
#!/usr/bin/env bash
version=$(just get-branch-image)
if [ "$version" == "master" ]; then
echo "Don't push from master"
exit 1
fi
{{ gradle-bin }} {{ project }}:jib -Pversion=$version
# Push all images for current branch
push-images:
#!/usr/bin/env bash
version=$(just get-branch-image)
if [ "$version" == "master" ]; then
echo "Don't push from master"
exit 1
fi
{{ gradle-bin }} jib -Pversion=$version
###############################################################################
## Helm chart
###############################################################################
chart-dir := base-directory / "deployment/helm/quick"
chart-target := base-directory / "deployment/charts"
# Create .tgz of helm chart
package-chart target=chart-target:
helm package {{ chart-dir }} -d {{ target }}
# Update the helm chart version (default latest release)
set-chart-version chart-version=version:
@echo "Update Helm chart to {{ chart-version }}"
sed -i "s/^version:.*$/version: {{ chart-version }}/" {{ chart-dir }}/Chart.yaml
sed -i "s/^appVersion:.*$/appVersion: {{ chart-version }}/" {{ chart-dir }}/Chart.yaml
###############################################################################
## E2E Tests
###############################################################################
e2e-dir := base-directory / "e2e/functional"
# Builds the e2e image test runner for quick cli dev
e2e-build-runner-dev quick-cli-dev-version:
docker build -t quick-e2e-test-runner --build-arg INDEX=test --build-arg QUICK_CLI_VERSION={{ quick-cli-dev-version }} {{ e2e-dir }}
# Builds the e2e image test runner for quick cli stable
e2e-build-runner quick-cli-version:
docker build -t quick-e2e-test-runner --build-arg --build-arg QUICK_CLI_VERSION={{ quick-cli-version }} {{ e2e-dir }}
# Runs all the e2e tests
e2e-run-all api-key quick-host:
docker run -v {{ e2e-dir }}:/tests -e X_API_KEY={{ api-key }} -e HOST={{ quick-host }} quick-e2e-test-runner --rm -it
# Runs the e2e CRUD tests
e2e-run-crud api-key quick-host:
docker run -v {{ e2e-dir }}/crud:/tests/crud -e X_API_KEY={{ api-key }} -e HOST={{ quick-host }} quick-e2e-test-runner --rm -it
# Runs the e2e multi-stream tests
e2e-run-multi-stream api-key quick-host:
docker run -v {{ e2e-dir }}/multi-stream:/tests/multi-stream -e X_API_KEY={{ api-key }} -e HOST={{ quick-host }} quick-e2e-test-runner --rm -it
# Runs the e2e range tests
e2e-run-range api-key quick-host:
docker run -v {{ e2e-dir }}/range:/tests/range -e X_API_KEY={{ api-key }} -e HOST={{ quick-host }} quick-e2e-test-runner --rm -it
# Runs the e2e range tests
e2e-run-range-key api-key quick-host:
docker run -v {{ e2e-dir }}/range:/tests/range-key -e X_API_KEY={{ api-key }} -e HOST={{ quick-host }} quick-e2e-test-runner --rm -it
# Runs the e2e schema tests
e2e-run-schema api-key quick-host:
docker run -v {{ e2e-dir }}/schema:/tests/schema -e X_API_KEY={{ api-key }} -e HOST={{ quick-host }} quick-e2e-test-runner --rm -it