version: '3'

silent: true

tasks:
  install:
    desc: install tools required for development or build
    cmds: [ task: install-golangci-lint ]

  install-golangci-lint:
    desc: install golangci-lint
    cmds: [ third_party/golangci-lint/download.sh ]

  world:
    desc: run - literally - evertyhing ;)
    cmds:
      - task: format
      - task: lint
      - task: test
      - task: vendor
      - task: build

  format:
    desc: format go-sources
    cmds: [ go fmt ./... ]

  lint:
    desc: lint go-sources
    cmds: [ third_party/golangci-lint/golangci-lint run ]

  test:
    cmds: [ go test ./... ]


  build:
    desc: build
    cmds: [ docker image build -t jaedle/mirror-to-gitea:development -f build/Dockerfile . ]

  vendor:
    desc: vendor dependencies
    cmds:
      - go mod tidy
      - go mod verify
      - go mod vendor

  default:
    cmds: [ task: world ]
