Files
query-orchestration/scripts/tests.yml
T

50 lines
1.2 KiB
YAML
Raw Normal View History

2024-12-19 11:38:57 +00:00
# https://taskfile.dev
version: '3'
includes:
docker:
taskfile: docker.yml
internal: true
vars:
2025-01-07 13:06:43 +00:00
COVERAGE_FILE: "{{.CONTEXT}}/{{.OUT_DIR}}/coverage.out"
2024-12-19 11:38:57 +00:00
tasks:
unit:
2025-01-07 16:30:45 +00:00
vars:
INTERNAL: "{{.CONTEXT}}/internal/..."
API: "{{.CONTEXT}}/api/..."
2024-12-19 11:38:57 +00:00
cmds:
- go test {{.INTERNAL}} {{.API}} -coverpkg={{.INTERNAL}},{{.API}} -coverprofile={{.COVERAGE_FILE}}
2024-12-19 11:38:57 +00:00
unit:coverage:
deps:
- unit
vars:
TMP_FILE: "{{.CONTEXT}}/{{.OUT_DIR}}/coverage.tmp"
cmds:
2025-01-07 13:06:43 +00:00
- go tool cover -func={{.COVERAGE_FILE}} > {{.TMP_FILE}}
2024-12-19 11:38:57 +00:00
- cat {{.TMP_FILE}}
- |
COVERAGE=$(grep total: {{.TMP_FILE}} | awk '{print $3}' | sed 's/%//' | bc)
echo ""
echo "Coverage Threshold: {{.COVERAGE_THRESHOLD}}%"
echo "Total Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < {{.COVERAGE_THRESHOLD}}" | bc -l) )); then
echo "Total Coverage below Coverage Threshold"
exit 1
fi
silent: true
integration:
2025-01-07 16:30:45 +00:00
deps:
- docker:build
2024-12-19 11:38:57 +00:00
cmds:
2025-01-07 16:30:45 +00:00
- task test:integration:nobuild
2024-12-19 11:38:57 +00:00
integration:nocache:
deps:
- docker:build
cmds:
2025-01-07 16:30:45 +00:00
- go test -count=1 -v {{.CONTEXT}}/test/...
integration:nobuild:
cmds:
- go test -v {{.CONTEXT}}/test/...