<commit_before>version: 1.2.0-3.{build}
environment:
  NIX_VERSION: 1.2.0
  NIX_BUILD_DIR: C:\nix_build
  DEPLOY_DIR: deploy
  BOOST_VERSION: 1.56.0
  BOOST_VERSION_SHORT: 1_56
  matrix:
  - PYVER: 27
    BITTNESS: 64
  - PYVER: 27
    BITTNESS: 32
  - PYVER: 34
    BITTNESS: 64
  - PYVER: 34
    BITTNESS: 32
build_script:
- ps: >-
    function Check-Error

    {
      param([int]$SuccessVal = 0)
      if ($SuccessVal -ne $LastExitCode) {
        throw "Failed with exit code $LastExitCode"
      }
    }


    $old_path = "$env:PYTHONPATH"

    $env:PYTHONPATH = "$env:APPVEYOR_BUILD_FOLDER;$env:PYTHONPATH"


    if ($env:BITTNESS -eq "64") {
      $PYTHON_ROOT = "C:\Python$env:PYVER-x64"
      $BITS = "64"
      $vcvars = "x86_amd64"
    } else {
      $PYTHON_ROOT = "C:\Python$env:PYVER"
      $BITS = "32"
      $vcvars = "x86"
    }

    $env:PATH = "$PYTHON_ROOT;$PYTHON_ROOT\Scripts;$env:PATH;C:\Program Files\7-Zip;$env:NIX_BUILD_DIR\nix\bin"


    python -c "import sys;print('Python version is {}'.format(sys.version))"

    Check-Error


    mkdir "$env:NIX_BUILD_DIR"

    Check-Error

    mkdir "$env:DEPLOY_DIR"

    Check-Error


    cd "$env:NIX_BUILD_DIR"

    mkdir nix

    Check-Error

    cd nix

    Invoke-WebRequest "https://github.com/G-Node/nix/releases/download/$env:NIX_VERSION/nix-$env:NIX_VERSION-win$BITS.exe" -OutFile "nix.exe"

    Check-Error

    7z x nix.exe

    Check-Error

    cd ..\


    mkdir boost

    mkdir boost_build

    cd boost

    $under = "$env:BOOST_VERSION" -replace "\.", "_"

    Invoke-WebRequest "http://heanet.dl.sourceforge.net/project/boost/boost/$env:BOOST_VERSION/boost_$under.7z" -OutFile "boost.7z"

    Check-Error

    7z x boost.7z

    Check-Error

    cd boost_$under


    echo "call ""\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" $vcvars && bootstrap && .\b2 install -j4 -a --prefix=$env:NIX_BUILD_DIR\boost_build toolset=msvc-12.0 architecture=x86 address-model=$BITS threading=multi variant=release link=static runtime-link=shared --with-python" | out-file -filepath "nix_compile.bat" -encoding ASCII

    .\nix_compile.bat

    Check-Error


    Copy-Item -Path "$env:NIX_BUILD_DIR\nix\COPYING","$env:NIX_BUILD_DIR\nix\LICENSE*" -Destination "$env:NIX_BUILD_DIR\nix\bin"

    Check-Error


    $env:BOOST_INCDIR = "$env:NIX_BUILD_DIR\boost_build\include\boost-$env:BOOST_VERSION_SHORT"

    $env:BOOST_LIBDIR = "$env:NIX_BUILD_DIR\boost_build\lib"

    $env:NIX_LIBDIR = "$env:NIX_BUILD_DIR\nix\lib"

    $env:NIX_INCDIR = "$env:NIX_BUILD_DIR\nix\include"


    python -m pip install pip wheel setuptools --upgrade

    Check-Error

    python -m pip install numpy --upgrade

    Check-Error


    $env:NIXPY_WHEEL_BINARIES = "$env:NIX_BUILD_DIR\nix\bin"

    cd "$env:APPVEYOR_BUILD_FOLDER"


    $env:DISTUTILS_USE_SDK = "1"

    $env:MSSdk = "1"

    echo "call ""\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" $vcvars" | out-file -filepath "python_compile.bat" -encoding ASCII

    echo "python setup.py build --with-nix" | out-file -filepath "python_compile.bat" -append -encoding ASCII

    echo "python setup.py test" | out-file -filepath "python_compile.bat" -append -encoding ASCII

    echo "python setup.py bdist_wheel -d ""$env:DEPLOY_DIR"" --with-nix" | out-file -filepath "python_compile.bat" -append -encoding ASCII

    if ($env:BITTNESS -eq "64" -and $env:PYVER -eq "27") {
      echo "python setup.py sdist -d ""$env:DEPLOY_DIR"" --with-nix" | out-file -filepath "python_compile.bat" -append -encoding ASCII
    }

    .\python_compile.bat

    Check-Error


    $env:PYTHONPATH = "$old_path"
artifacts:
- path: $(DEPLOY_DIR)\*
  name: wheels<commit_msg>[appveyor] Simplify build and run tests<commit_after>version: 1.2.0-3.{build}

environment:

  NIX_VERSION: 1.2.0
  NIX_BUILD_DIR: C:\nix_build
  DEPLOY_DIR: deploy
  BOOST_ROOT: C:\Libraries\boost_1_62_0

  NIX_APPVEYOR_ROOT: https://ci.appveyor.com/api/projects/stoewer/nix/artifacts/build


  matrix:
    # Miniconda 32 bit
    - MINICONDA: "C:\\Miniconda"
      bits: 32
      withnix: "--without-nix"
    - MINICONDA: "C:\\Miniconda"
      bits: 32
      withnix: "--with-nix"

    # Miniconda35 32 bit
    - MINICONDA: "C:\\Miniconda35"
      bits: 32
      withnix: "--without-nix"
    - MINICONDA: "C:\\Miniconda35"
      bits: 32
      withnix: "--with-nix"

    # Miniconda 64 bit
    - MINICONDA: "C:\\Miniconda-x64"
      bits: 64
      withnix: "--without-nix"
    - MINICONDA: "C:\\Miniconda-x64"
      bits: 64
      withnix: "--with-nix"

    # Miniconda35 64 bit
    - MINICONDA: "C:\\Miniconda35-x64"
      bits: 64
      withnix: "--without-nix"
    - MINICONDA: "C:\\Miniconda35-x64"
      bits: 64
      withnix: "--with-nix"

matrix:
    allow_failures:
        - withnix: "--with-nix"

init:
  - "ECHO %MINICONDA% %vcvars% (%bits%)"
  - ps: $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH;C:\Program Files\7-Zip;$env:NIX_BUILD_DIR\nix\bin"
  - python -c "import sys;print('Python version is {}'.format(sys.version))"

install:

    - ps: |
        if ($env:bits -eq "64") {
            $env:vcvars = "x86_amd64"
            $env:avjob = "job=Environment%3A%20PLATFORM%3Dx64%2C%20CONFIGURATION%3DRelease"
            $env:avfname = "nix-$env:NIX_VERSION-win64.exe"
        } else {
            $env:vcvars = "x86"
            $env:avjob = "job=Environment%3A%20PLATFORM%3Dx86%2C%20CONFIGURATION%3DRelease"
            $env:avfname = "nix-$env:NIX_VERSION-win32.exe"
        }

    - ps: |
        if ($env:withnix -eq "--with-nix") {
            mkdir "$env:NIX_BUILD_DIR"
            cd "$env:NIX_BUILD_DIR"
            mkdir nix
            cd nix

            $env:nix_exe_url = "$env:NIX_APPVEYOR_ROOT/$env:avfname`?$env:avjob"
            Write-Host "Downloading $env:nix_exe_url"

            Invoke-WebRequest -URI $env:nix_exe_url -OutFile "nix.exe"

            7z x nix.exe

            cd ..

            $env:BOOST_INC_DIR = "$env:BOOST_ROOT\include"
            $env:BOOST_LIB_DIR = "$env:BOOST_ROOT\lib"
        }

    - conda update --all --yes

    - conda install --yes numpy

    - conda install --yes h5py

    - ps: cd "$env:APPVEYOR_BUILD_FOLDER"

    - ps: $env:DISTUTILS_USE_SDK = "1"

    - ps: $env:MSSdk = "1"

build_script:
    - python setup.py build %withnix%

test_script:
    - python setup.py test

after_test:
    - ps: mkdir "$env:DEPLOY_DIR"

    - python setup.py bdist_wheel -d %DEPLOY_DIR% %withnix%

    - ps: |
        if ($env:bits -eq "64" -and $env:PYVER -eq "27") {
            python setup.py sdist -d $env:DEPLOY_DIR $env:withnix
        }

artifacts:
- path: $(DEPLOY_DIR)\*
  name: wheels

# Uncomment on_finish block to enable RDP
# on_finish:
#   - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
{'fraction_non_alphanumeric': 0.14406041243101947, 'fraction_numerical': 0.02483299448155678, 'mean_word_length': 2.6632978723404257, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4386047', 'n_tokens_mistral': 2932, 'n_tokens_neox': 2625, 'n_words': 488}