version: "{build}"
platform: x64
image: Visual Studio 2017

clone_folder: c:\boilerplate
cache:
  - vendor

install:
  - curl -SLko protoc.zip https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-win32.zip
  - 7z e protoc.zip
  - move protoc.exe C:\msys64\mingw64\bin

build_script:
  - go version
  - set PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;C:\msys64\usr\bin;C:\msys64\mingw64\bin;%PATH%
  - set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
  - make
  - copy /y "C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\lib\libgcc_s_seh-1.dll"
  - copy /y "C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\lib\libstdc++-6.dll"
  - copy /y "C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\lib\libwinpthread-1.dll"
  - 7z a hercules.win64.zip hercules.exe "libgcc_s_seh-1.dll" "libstdc++-6.dll" "libwinpthread-1.dll"

test_script:
  - go test -v -timeout 20m -race -tags disable_babelfish gopkg.in/src-d/hercules.v10/...

artifacts:
  - name: hercules.win64.zip
    path: hercules.win64.zip

deploy:
  release: $(APPVEYOR_REPO_TAG_NAME)
  provider: GitHub
  auth_token:
    secure: 78zsH4q19DqcpdkwnYHQoe0BakBfv+LGu1W7mXuaBC9mS87+EuAj3+yTzJv4NEfI
  artifact: hercules.win64.zip
  on:
    branch: master
    appveyor_repo_tag: true
