-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
64 lines (58 loc) · 1.83 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
version: "3"
includes:
temporal:
taskfile: "temporal/Taskfile.yml"
dir: "./temporal"
env:
TEST_TIMEOUT:
sh: echo ${TEST_TIMEOUT:-"5m"}
REDIS_ADDR: "localhost:6379"
tasks:
build:
desc: "Build the project"
cmds:
- go build -v ./...
run-tests:
desc: "Run Go tests for specified storage and database"
cmds:
- |
echo "Running tests for {{.STORAGE_TYPE}} {{.DB}} {{.DB_VERSION}} "
if [ -z "{{.STORAGE_TYPE}}" ] || [ -z "{{.DB}}" ]; then
echo "STORAGE_TYPE and DB must be set."
exit 1
fi
for pkg in $(go list ./{{.STORAGE_TYPE}}/...); do
pkg_base=$(basename $pkg)
coveragefile="${pkg_base}.cov"
tags=$([[ ${pkg} == *"driver"* ]] && echo "-tags {{.DB}}{{.DB_VERSION}} " || echo "")
go test -failfast -timeout $TEST_TIMEOUT -race -cover $tags -coverprofile=${coveragefile} -v ${pkg}
if [ -f "${coveragefile}" ]; then
mkdir -p "coverage/$(dirname ${pkg})"
mv ${coveragefile} "coverage/${pkg}.cov"
fi
done
merge-coverage:
desc: "Merge coverage files into a single file"
cmds:
- |
gocovmerge $(find . -name '*.cov') > merged-coverage.cov
test-persistent:
desc: "Run tests for persistent storage with specified database"
cmds:
- task: run-tests
vars:
STORAGE_TYPE: persistent
DB: "{{.DB}}"
DB_SETUP: "{{.DB_SETUP}}"
DB_VERSION: "{{.DB_VERSION}}"
test-temporal:
desc: "Run tests for temporal storage with specified database"
cmds:
- task: temporal:run-tests
vars:
STORAGE_TYPE: temporal
DB: "{{.DB}}"
DB_SETUP: "{{.DB_SETUP}}"
DB_VERSION: "{{.DB_VERSION}}"
- mkdir -p coverage/temporal
- cp temporal/*.cov coverage/temporal/