Files
go-caatsm/Taskfile.yml
T

126 lines
3.4 KiB
YAML

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 -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
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 coverage - Generate test coverage report"
- 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 upgrade - Upgrade go dependencies"
- echo " task help - Show this help message"