Skip to content

087 - Makefile Targets

Build targets with embedded shell commands. This is an example of a MAML document.

maml
# Build targets
{
  project: "seagull"
  default: "build"
  targets: {
    # Build the application
    build: {
      deps: [
        "clean"
        "lint"
      ]
      script: """
echo "Building..."
go build -o bin/app ./cmd/app
echo "Build complete"
"""
    }

    # Run tests with coverage
    test: {
      script: """
echo "Running tests..."
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
"""
    }

    clean: {
      script: """
rm -rf bin/ dist/ coverage.out coverage.html
echo "Cleaned"
"""
    }

    # Docker build and push
    docker: {
      deps: [
        "build"
      ]
      script: """
docker build -t shadowbox:latest .
docker push formation:latest
"""
    }
  }
}

See Also