<commit_before>version: 1.0.{build}

os: Visual Studio 2015

platform: x64

configuration: Release

branches:
  only:
    - master
    - latest
    - release

matrix:
  fast_finish: false # set this flag to immediately finish build once one of the jobs fails.

environment:
  matrix:
    - DB: MySQL
      USE_UNICODE: OFF
      USE_BOOST_CONVERT: OFF
      USE_NODATA_BUG: OFF
    - DB: PostgreSQL
      USE_UNICODE: OFF
      USE_BOOST_CONVERT: OFF
      USE_NODATA_BUG: OFF
    - DB: MSSQL
      USE_UNICODE: OFF
      USE_BOOST_CONVERT: OFF
      USE_NODATA_BUG: OFF

shallow_clone: true
clone_depth: 5

# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then:
# 1. Uncomment the on_finish section below:
#on_finish:
#  - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# 2. Add this line to the init section below
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

init:
  - ps: 'Get-ChildItem Env: | %{"{0}={1}" -f $_.Name,$_.Value}'
  - ps: 'Get-OdbcDriver -Platform 64-bit | Select-Object -ExpandProperty Name'

services:
  - mssql2014   # start SQL Server 2014 Express
  - mysql       # start MySQL 5.x service
  - postgresql  # start PostgreSQL 9.x service

before_build:
  - ps: |
      if ($env:DB -Match "MSSQL") {
        ;
      }
      elseif ($env:DB -Match "MySQL") {
        $env:MYSQL_PWD="<PASSWORD>!"
        $cmd = '"C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin\mysql" -e "create database nanodbc_test;" --user=root'
        iex "& $cmd"
      }
      elseif ($env:DB -Match "PostgreSQL") {
        $env:PGUSER="postgres"
        $env:PGPASSWORD="<PASSWORD>!"
        $cmd = '"C:\Program Files\PostgreSQL\9.3\bin\createdb" nanodbc_test'
        iex "& $cmd"
      }
      else {
        throw 'TODO: ' + $env:DB + ' not configured yet'
      }
      if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
  - cmd: call .\scripts\appveyor\configure.bat

build:
  parallel: true
  project: nanodbc.sln
  verbosity: minimal

test_script:
  - ps: |
      if ($env:DB -Match "MSSQL") {
        $env:NANODBC_TEST_CONNSTR="Driver={ODBC Driver 11 for SQL Server};Server=(local)\SQL2014;Database=master;UID=sa;PWD=<PASSWORD>!;"
        $test_name = "mssql_test"
      }
      elseif ($env:DB -Match "MySQL") {<commit_msg>Switch back to x64 installation of MySQL.<commit_after>version: 1.0.{build}

os: Visual Studio 2015

platform: x64

configuration: Release

branches:
  only:
    - master
    - latest
    - release

matrix:
  fast_finish: false # set this flag to immediately finish build once one of the jobs fails.

environment:
  matrix:
    - DB: MySQL
      USE_UNICODE: OFF
      USE_BOOST_CONVERT: OFF
      USE_NODATA_BUG: OFF
    - DB: PostgreSQL
      USE_UNICODE: OFF
      USE_BOOST_CONVERT: OFF
      USE_NODATA_BUG: OFF
    - DB: MSSQL
      USE_UNICODE: OFF
      USE_BOOST_CONVERT: OFF
      USE_NODATA_BUG: OFF

shallow_clone: true
clone_depth: 5

# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then:
# 1. Uncomment the on_finish section below:
#on_finish:
#  - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# 2. Add this line to the init section below
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

init:
  - ps: 'Get-ChildItem Env: | %{"{0}={1}" -f $_.Name,$_.Value}'
  - ps: 'Get-OdbcDriver -Platform 64-bit | Select-Object -ExpandProperty Name'

services:
  - mssql2014   # start SQL Server 2014 Express
  - mysql       # start MySQL 5.x service
  - postgresql  # start PostgreSQL 9.x service

before_build:
  - ps: |
      if ($env:DB -Match "MSSQL") {
        ;
      }
      elseif ($env:DB -Match "MySQL") {
        $env:MYSQL_PWD="<PASSWORD>!"
        $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -e "create database nanodbc_test;" --user=root'
        iex "& $cmd"
      }
      elseif ($env:DB -Match "PostgreSQL") {
        $env:PGUSER="postgres"
        $env:PGPASSWORD="<PASSWORD>!"
        $cmd = '"C:\Program Files\PostgreSQL\9.3\bin\createdb" nanodbc_test'
        iex "& $cmd"
      }
      else {
        throw 'TODO: ' + $env:DB + ' not configured yet'
      }
      if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
  - cmd: call .\scripts\appveyor\configure.bat

build:
  parallel: true
  project: nanodbc.sln
  verbosity: minimal

test_script:
  - ps: |
      if ($env:DB -Match "MSSQL") {
        $env:NANODBC_TEST_CONNSTR="Driver={ODBC Driver 11 for SQL Server};Server=(local)\SQL2014;Database=master;UID=sa;PWD=<PASSWORD>!;"
        $test_name = "mssql_test"
      }
      elseif ($env:DB -Match "MySQL") {
{'fraction_non_alphanumeric': 0.13607214428857717, 'fraction_numerical': 0.01603206412825651, 'mean_word_length': 2.8600154679040988, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2426175', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1798, 'n_words': 411}