build: off

image: Visual Studio 2019

clone_folder: c:\gopath\src\github.com\thrasher-corp\gocryptotrader

cache:
  - '%APPDATA%\npm-cache'
  - '%GOPATH%\pkg\mod'
  - '%LOCALAPPDATA%\go-build'
  - c:\gopath\src\github.com\thrasher-corp\gocryptotrader\web\node_modules

environment:
  GOPATH: c:\gopath
  GO111MODULE: on
  NODEJS_VER: 10.15.3
  APPVEYOR_SAVE_CACHE_ON_ERROR: true
  POSTGRES_PATH: C:\Program Files\PostgreSQL\9.6
  PGUSER: postgres
  PGPASSWORD: Password12!
  POSTGRES_ENV_POSTGRES_USER: postgres
  POSTGRES_ENV_POSTGRES_PASSWORD: Password12!
  POSTGRES_ENV_POSTGRES_DB: gct_dev_ci
  PSQL_USER: postgres
  PSQL_HOST: localhost
  PSQL_PASS: Password12!
  PSQL_DBNAME: gct_dev_ci
  PSQL_SSLMODE: disable
  PSQL_SKIPSQLCMD: true
  PSQL_TESTDBNAME: gct_dev_ci
stack: go 1.17.x

services:
  - postgresql96

init:
  - SET PATH=%POSTGRES_PATH%\bin;%PATH%

install:
  - set Path=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%Path%
  - ps: Install-Product node $env:NODEJS_VER
  - cd c:\gopath\src\github.com\thrasher-corp\gocryptotrader\web
  - npm install

build_script:
  - createdb gct_dev_ci

before_test:
  - cd c:\gopath\src\github.com\thrasher-corp\gocryptotrader
  - go env
  - go version
  - go install

test_script:
  # test back-end
  - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.42.1
  - '%GOPATH%\bin\golangci-lint.exe run --verbose'
  - ps: >-
      if($env:APPVEYOR_SCHEDULED_BUILD -eq 'true') {
          go test -race ./... -tags=mock_test_off
      }else {
          go test -race ./...
      }
  
  # test front-end
  - node --version
  - npm --version
  - cd c:\gopath\src\github.com\thrasher-corp\gocryptotrader\web
  - npm run lint
  - npm run build
