Taskfile

Taskfile (Task): A Modern Make Alternative

Overview
Task is a task runner / build tool that aims to be simpler and easier to use than GNU Make. It uses a simple YAML schema (`Taskfile.yml`) instead of the archaic Makefile syntax, making it cross-platform and developer-friendly.

Why Replace Make?
- Syntax: YAML is readable; Make's tab-indentation rules are frustrating.
- Cross-Platform: Works identically on Linux, macOS, and Windows.
- Features: Built-in support for environment variables, semantic versioning, and conditional execution.

Example `Taskfile.yml`

version: '3'

tasks:
  build:
    desc: Build the application
    cmds:
      - go build -o app main.go
    sources:
      - ./**/*.go
    generates:
      - app

  run:
    desc: Run the app
    deps: [build]
    cmds:
      - ./app

  clean:
    cmds:
      - rm -f app

Key Features

1. Dependencies
Execute tasks in order. `deps: [build]` ensures build runs before run.

2. Checksum / Rebuilding
The `sources` and `generates` keywords allow Task to skip steps if files haven't changed (incremental builds).

3. Variables with Templates

vars:
  GREETING: Hello
tasks:
  greet:
    cmds:
      - echo "{{.GREETING}} World"

Installation

# MacOS
brew install go-task/tap/go-task

# Linux
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d

Run with: `task build`

Task allows you to capture operational knowledge (how to build, test, deploy) in a readable file checked into Git.

Take taskfile further

Ask the copilot about this term, or have our engineers assess it against your process.