.appveyor.yml 2.52 KB
Newer Older
1
version: 2.2.4.{build}
2

3
4
5
image: Visual Studio 2015
platform: x64
configuration:  # a trick to construct a build matrix with multiple Python versions
6
  - 3.6
Guolin Ke's avatar
Guolin Ke committed
7
8
9

environment:
  matrix:
10
11
    - COMPILER: MSVC
    - COMPILER: MINGW
Guolin Ke's avatar
Guolin Ke committed
12
13
14

clone_depth: 50

15
install:
16
  - git submodule update --init --recursive  # get `compute` folder
17
  - set PATH=%PATH:C:\Program Files\Git\usr\bin;=%  # delete sh.exe from PATH (mingw32-make fix)
Nikita Titov's avatar
Nikita Titov committed
18
  - set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%
19
20
21
22
23
24
  - set PYTHON_VERSION=%CONFIGURATION%
  - ps: >-
      switch ($env:PYTHON_VERSION) {
          "2.7" {$env:MINICONDA = """C:\Miniconda-x64"""}
          "3.5" {$env:MINICONDA = """C:\Miniconda35-x64"""}
          "3.6" {$env:MINICONDA = """C:\Miniconda36-x64"""}
25
26
          "3.7" {$env:MINICONDA = """C:\Miniconda37-x64"""}
          default {$env:MINICONDA = """C:\Miniconda37-x64"""}
27
28
29
      }
  - set PATH=%MINICONDA%;%MINICONDA%\Scripts;%PATH%
  - ps: $env:LGB_VER = (Get-Content VERSION.txt).trim()
30
  - activate
31
  - conda config --set always_yes yes --set changeps1 no
32
  - conda update -q -y conda
33
  - conda create -q -y -n test-env python=%PYTHON_VERSION% joblib matplotlib numpy pandas psutil pytest python-graphviz scikit-learn scipy
34
  - activate test-env
Nikita Titov's avatar
Nikita Titov committed
35
  - set PATH=%CONDA_PREFIX%\Library\bin\graphviz;%PATH%  # temp graphviz hotfix
Guolin Ke's avatar
Guolin Ke committed
36

Guolin Ke's avatar
Guolin Ke committed
37
build_script:
38
  - cd %APPVEYOR_BUILD_FOLDER%\python-package
39
  - IF "%COMPILER%"=="MINGW" (
40
    python setup.py install --mingw)
41
    ELSE (
42
43
44
    python setup.py install)

test_script:
45
46
  - pytest %APPVEYOR_BUILD_FOLDER%\tests\python_package_test
  - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide
47
  - ps: >-
Nikita Titov's avatar
Nikita Titov committed
48
      @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py"  # prevent interactive window mode
49
      (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py"
50
51
  - ps: >-
      foreach ($file in @(Get-ChildItem *.py)) {
52
        @("import sys, warnings", "warnings.showwarning = lambda message, category, filename, lineno, file=None, line=None: sys.stdout.write(warnings.formatwarning(message, category, filename, lineno, line))") + (Get-Content $file) | Set-Content $file
53
        python $file
54
        if (!$?) { $host.SetShouldExit(-1) }
55
      }  # run all examples
56
  - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide\notebooks
Nikita Titov's avatar
Nikita Titov committed
57
  - conda install -q -y -n test-env ipywidgets notebook
58
  - jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb  # run all notebooks