version: '3' vars: app_name: tele-proc go_files: sh: find . -name '*.go' -type f config_dir: configs build_dir: build main_receiver: ./cmd/main/main.go hasura_endpoint: http://localhost:8080/v1/graphql schema_file: ./internal/repository/schema.graphql hasura_secret: # Set your Hasura admin secret here tasks: all: desc: Default target cmds: - task: build build: desc: Build the receiver application cmds: - task: build-receiver build-receiver: desc: Build the receiver application cmds: - echo "Building receiver..." - go build -o {{.build_dir}}/receiver {{.main_receiver}} run: desc: Run the receiver application with different configurations cmds: - task: run-dev run-dev: desc: Run the receiver in development mode cmds: - task: build-receiver - echo "Running receiver in development mode..." - GO_ENV=dev {{.build_dir}}/receiver listen run-prod: desc: Run the receiver in production mode cmds: - task: build-receiver - echo "Running receiver in production mode..." - GO_ENV=prod {{.build_dir}}/receiver run-test: desc: Run the receiver in test mode cmds: - task: build-receiver - echo "Running receiver in test mode..." - GO_ENV=test {{.build_dir}}/receiver upgrade: desc: Upgrade go dependencies cmds: - echo "Upgrading go dependencies..." - go get -u -d -v ./... - go mod tidy install-test: desc: Install ginkgo for testing cmds: - echo "Installing ginkgo..." - go install github.com/onsi/ginkgo/v2/ginkgo - go get github.com/onsi/gomega/... test: desc: Test the application cmds: - echo "Running tests..." - ginkgo -r -v coverage: desc: Generate test coverage report cmds: - echo "Generating test coverage report..." - ginkgo --json-report ./ginkgo.report -coverpkg=./... -coverprofile=./coverage/coverage.out -r - go tool cover -html=./coverage/coverage.out -o ./coverage/coverage.html clean: desc: Clean build artifacts cmds: - echo "Cleaning build artifacts..." - rm -rf {{.build_dir}} fmt: desc: Format the code cmds: - echo "Formatting code..." - go fmt ./... deps: desc: Install dependencies cmds: - echo "Installing dependencies..." - go mod tidy lint: desc: Lint the code cmds: - echo "Linting code..." - golangci-lint run install-gq: desc: Install hasura graphql engine introspection tool cmds: - echo "Installing gq..." - pnpm add -g graphqurl schema: desc: Download the GraphQL schema from Hasura server cmds: - echo "Downloading GraphQL schema..." - > gq {{.hasura_endpoint}} -H 'X-Hasura-Admin-Secret: {{.hasura_secret}}' --introspect > {{.schema_file}} gen: desc: Generate code using genqlient cmds: - echo "Generating code using genqlient..." - cd internal/repository && go run github.com/Khan/genqlient && cd ../.. help: desc: Show this help message cmds: - echo "Taskfile usage:" - echo " task build - Build the application" - echo " task run - Run the receiver in development mode" - echo " task run-dev - Run the receiver in development mode" - echo " task run-prod - Run the receiver in production mode" - echo " task run-test - Run the receiver in test mode" - echo " task test - Run tests" - echo " task install-test - Install ginkgo for testing" - echo " task clean - Clean build artifacts" - echo " task fmt - Format the code" - echo " task deps - Install dependencies" - echo " task lint - Lint the code" - echo " task install-gq - Install hasura graphql engine introspection tool" - echo " task schema - Download the GraphQL schema from Hasura server" - echo " task gen - Generate code using genqlient" - echo " task upgrade - Upgrade go dependencies" - echo " task help - Show this help message"