Files
query-orchestration/scripts/Taskfile.yml
T

165 lines
5.2 KiB
YAML
Raw Normal View History

2025-01-10 11:12:03 +00:00
---
2024-12-19 11:38:57 +00:00
# https://taskfile.dev
version: "3"
2024-12-19 11:38:57 +00:00
2025-01-10 12:58:14 +00:00
vars:
OUT_DIR: out
2024-12-19 11:38:57 +00:00
includes:
test:
dir: ".."
2024-12-19 11:38:57 +00:00
taskfile: tests.yml
docker:
dir: ".."
2024-12-19 11:38:57 +00:00
taskfile: docker.yml
2025-01-15 19:45:51 +00:00
openapi:
dir: ".."
taskfile: openapi-scripts.yml
2024-12-19 11:38:57 +00:00
compose:
dir: ".."
taskfile: local-deployments.yml
2024-12-19 11:38:57 +00:00
db:
dir: ".."
2024-12-19 11:38:57 +00:00
taskfile: database.yml
tasks:
fullsuite:
desc: "Generate, build, lint, and run functional tests (incremental by default)"
vars:
INCREMENTAL: "{{.INCREMENTAL | default \"true\"}}"
cmds:
- task: build:deps
- task: fullsuite:build
- task: test:functional
vars:
INCREMENTAL: "{{.INCREMENTAL}}"
fullsuite:ci:
desc: "Full CI run of fullsuite with INCREMENTAL=false (must pass clean)"
cmds:
- task: fullsuite
vars:
INCREMENTAL: "false"
2025-06-02 10:44:45 +00:00
fullsuite:build:
2025-04-25 17:02:50 +00:00
internal: true
cmds:
2025-06-02 10:44:45 +00:00
- task: build
- task: lint
fullsuite:graph:
desc: "Run fullsuite under psrecord and plot CPU/memory to out/fullsuite.png"
cmds:
- psrecord "task fullsuite" --plot out/fullsuite.png --interval 0.1 --include-children
precommit:
desc: "Pre-commit checks (runs all linters) for CI/CD readiness"
cmds:
- task: lint
deps:tidy:
desc: "Run go mod tidy and refresh the vendor directory"
cmds:
- go mod tidy
- go mod vendor
build:
desc: "Generate code and build the queryorchestration docker image"
2025-04-25 17:02:50 +00:00
deps:
- build:deps
cmd:
task: docker:build
2025-04-25 17:02:50 +00:00
build:deps:
internal: true
2025-06-02 10:44:45 +00:00
run: once
2025-04-25 17:02:50 +00:00
cmds:
- task: deps:tidy
- task: generate
2024-12-19 11:38:57 +00:00
generate:
desc: "Run all code generators (db, openapi, docs, go generate)"
run: once
cmds:
- task: db:generate
- task: openapi:generate
# NOTE: test:mocks:generate removed - mocks are deprecated
- task: docs:generate
2025-04-25 17:02:50 +00:00
- task: go:generate
go:generate:
desc: "Run `go generate ./...` across the module"
cmds:
- go generate ./...
2024-12-19 11:38:57 +00:00
lint:
desc: "Run every linter (db, go, yaml, json, docker, openapi, compose)"
cmds:
- task: db:lint
- task: go:lint
- task: yaml:lint
- task: json:lint
- task: docker:lint
- task: openapi:lint
- task: compose:lint
go:lint:
desc: "Run golangci-lint over the module"
cmds:
- golangci-lint run {{.CLI_ARGS}}
# - govulncheck ./...
yaml:lint:
desc: "Lint all YAML files in the repo with yamllint"
cmds:
- yamllint . -s {{.CLI_ARGS}}
json:lint:
desc: "Lint devbox.json with jsonlint"
cmds:
- jsonlint devbox.json -q -s -i {{.CLI_ARGS}}
2025-03-05 13:50:43 +00:00
docs:generate:
desc: "Regenerate Go package docs under cmd/ via gomarkdoc"
run: once
2024-12-19 11:38:57 +00:00
cmds:
2025-03-05 13:50:43 +00:00
- gomarkdoc --template-file file=docs/templates/root.gotxt ./cmd/...
docs:ai:generate:
desc: "Generate full system docs ($$)"
cmds:
- bash docs/ai.generated/prompts/regenerate_docs.sh docs/ai.generated/prompts/prompt.for.system.documentation.generation.md
aws:login:
desc: "Authenticate to AWS via SSO (`aws sso login`)"
cmds:
# Unset AWS_ENDPOINT_URL for this call only — LocalStack override in .env
# otherwise redirects the SSO OIDC RegisterClient call to localhost:4566.
- env -u AWS_ENDPOINT_URL aws sso login
2025-04-22 19:57:35 +00:00
aws:textract:credentials:
desc: "Refresh AWS_*_TEXTRACT credentials in .env from the current AWS profile"
cmds:
- |
sed -i '/^AWS_REGION_TEXTRACT\|^AWS_ACCESS_KEY_ID_TEXTRACT\|^AWS_SECRET_ACCESS_KEY_TEXTRACT\|^AWS_SESSION_TOKEN_TEXTRACT/d' .env
echo "AWS_REGION_TEXTRACT=$(aws configure get region --profile $AWS_PROFILE)" >> .env
CREDENTIALS_JSON=$(aws configure export-credentials --profile $AWS_PROFILE)
echo "AWS_ACCESS_KEY_ID_TEXTRACT=$(echo $CREDENTIALS_JSON | jq -r '.AccessKeyId')" >> .env
echo "AWS_SECRET_ACCESS_KEY_TEXTRACT=$(echo $CREDENTIALS_JSON | jq -r '.SecretAccessKey')" >> .env
echo "AWS_SESSION_TOKEN_TEXTRACT=$(echo $CREDENTIALS_JSON | jq -r '.SessionToken')" >> .env
dev:queryAPI:
desc: "Run queryAPI locally with version info"
vars:
BUILD_TIME:
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
GIT_SHORT_COMMIT:
sh: git rev-parse --short HEAD
GIT_VERSION:
sh: echo "$(date -u +"%Y%m%d.%H%M%S")-$(git rev-parse --short HEAD)"
GIT_COMMIT:
sh: git rev-parse HEAD
cmds:
- echo "Starting queryAPI with version={{.GIT_VERSION}} buildTime={{.BUILD_TIME}} commit={{.GIT_COMMIT}}"
- |
go run -ldflags "\
-X queryorchestration/internal/serviceconfig/build.version={{.GIT_VERSION}} \
-X queryorchestration/internal/serviceconfig/build.buildTime={{.BUILD_TIME}} \
-X queryorchestration/internal/serviceconfig/build.gitCommit={{.GIT_COMMIT}}" \
cmd/queryAPI/main.go
integration:admin:
desc: "Run admin user management integration tests (requires real AWS/Permit.io credentials)"
dir: ../test/integration
cmds:
- |
if [ ! -f .env ]; then
echo "❌ Error: test/integration/.env not found"
echo "Copy .env.example to .env and configure your credentials"
echo "See test/integration/README.md for setup instructions"
exit 1
fi
- go test -tags=integration -v ./...