version: 1.0.{build}.{branch}

build: off

environment:
  matrix:

    # Pre-installed Python versions, which Appveyor may upgrade to
    # a later point release.
    # See: http://www.appveyor.com/docs/installed-software#python

    # We test on 32-bit Python 2.7, and 64-bit Python 3.x.
    # This is because it takes too long to serially go through six to eight
    # iterations.

    - PYTHON: "C:\\Python27"
    - PYTHON: "C:\\Python35-x64"

install:
  - cmd: echo "Filesystem root:"
  - dir C:\

  - echo "Installed SDKs:"
  - dir "C:\Program Files\Microsoft SDKs\Windows"

  # Prepend "current" Python to the PATH of this build (this cannot be
  # done from inside the powershell script as it would require to restart
  # the parent CMD process).
  - SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%

  # https://stackoverflow.com/a/4509885/1068170
  # Set `PYTHON_ARCH` (either 32 or 64)
  - set PY_CMD=python -c "import platform; print(platform.architecture()[0][:2])"
  - for /f "tokens=1 delims=" %%i in ('%PY_CMD%') do set PYTHON_ARCH=%%i
  # Set `PYTHON_VERSION`
  - set PY_CMD=python -c "import platform; print(platform.python_version())"
  - for /f "tokens=1 delims=" %%i in ('%PY_CMD%') do set PYTHON_VERSION=%%i

  # Check that we have the expected version and architecture for Python
  - python appveyor\env_info.py

  # Upgrade to the latest version of pip.
  - python -m pip install --upgrade pip setuptools

  # Install the build dependencies of the project (assumes all extensions
  # are pure Python or have wheels, so they don't need to be built).
  - python -m pip install -r appveyor\requirements.txt

test_script:
  # Run the project tests
  - "%PYTHON%\\Scripts\\nox.exe -f api_core\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f asset\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f bigquery\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f bigquery_datatransfer\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f bigtable\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f container\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f core\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f dataproc\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f datastore\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f dns\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f error_reporting\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f firestore\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f language\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f logging\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f monitoring\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f pubsub\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f resource_manager\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f runtimeconfig\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f spanner\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f speech\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f storage\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f trace\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f translate\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f videointelligence\\nox.py -s default"
  - "%PYTHON%\\Scripts\\nox.exe -f vision\\nox.py -s default"
