451da3d26d
Support for service accounts with static credentials * feature complete * tests and docs * lint fix
165 lines
5.2 KiB
YAML
165 lines
5.2 KiB
YAML
---
|
|
# https://taskfile.dev
|
|
|
|
version: "3"
|
|
|
|
vars:
|
|
OUT_DIR: out
|
|
|
|
includes:
|
|
test:
|
|
dir: ".."
|
|
taskfile: tests.yml
|
|
docker:
|
|
dir: ".."
|
|
taskfile: docker.yml
|
|
openapi:
|
|
dir: ".."
|
|
taskfile: openapi-scripts.yml
|
|
compose:
|
|
dir: ".."
|
|
taskfile: local-deployments.yml
|
|
db:
|
|
dir: ".."
|
|
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"
|
|
fullsuite:build:
|
|
internal: true
|
|
cmds:
|
|
- 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"
|
|
deps:
|
|
- build:deps
|
|
cmd:
|
|
task: docker:build
|
|
build:deps:
|
|
internal: true
|
|
run: once
|
|
cmds:
|
|
- task: deps:tidy
|
|
- task: generate
|
|
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
|
|
- task: go:generate
|
|
go:generate:
|
|
desc: "Run `go generate ./...` across the module"
|
|
cmds:
|
|
- go generate ./...
|
|
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}}
|
|
docs:generate:
|
|
desc: "Regenerate Go package docs under cmd/ via gomarkdoc"
|
|
run: once
|
|
cmds:
|
|
- 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
|
|
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 ./...
|