# https://taskfile.dev

version: '3'

tasks:
  default:
    cmds:
      - task --list-all
    silent: true
  test:
    desc: Execute unit tests in Go.
    cmds:  
      - echo "Execute unit tests in Go."
      - go test -cover -v ./...

  test-fuzz:
    desc: Conduct fuzzing tests.#
    cmds:  
      - echo "Conduct fuzzing tests."
      - go test -v -fuzztime=30s -fuzz=Fuzz ./...

  add-licenses:
    desc: Attach license headers to Go files.
    cmds:
      - echo "Attach license headers to Go files."
      - addlicense -c "schukai GmbH" -s -l "AGPL-3.0" ./*.go
    silent: true

  check:
    desc: Confirm repository status.
    cmds:
      - git diff-index --quiet HEAD || (echo "There are uncommitted changes after running make. Please commit or stash them before running make."; exit 1)
    silent: true

  build:
    desc: Compile the application,
    aliases:
      - b
    vars:
      DEVENV_ROOT:
        sh: echo "$DEVENV_ROOT"
    
    cmds:
      - devenv shell build-app
    sources:
      - source/**/*.go
      - source/**/*.mod
      - dist/**