diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6919001464096..2c19db7c9aaae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -242,6 +242,7 @@ jobs: PYTHON_ARCH: '64' PYTEST_VERSION: '*' COVERAGE: 'true' + DISTRIB: 'conda' py37_pip_openblas_32bit: PYTHON_VERSION: '3.7' PYTHON_ARCH: '32' diff --git a/build_tools/azure/install.cmd b/build_tools/azure/install.cmd deleted file mode 100644 index caf28261dcc9f..0000000000000 --- a/build_tools/azure/install.cmd +++ /dev/null @@ -1,45 +0,0 @@ -@rem https://github.com/numba/numba/blob/master/buildscripts/incremental/setup_conda_environment.cmd -@rem The cmd /C hack circumvents a regression where conda installs a conda.bat -@rem script in non-root environments. -set CONDA_INSTALL=cmd /C conda install -q -y -set PIP_INSTALL=pip install -q - -@echo on - -IF "%PYTHON_ARCH%"=="64" ( - @rem Deactivate any environment - call deactivate - @rem Clean up any left-over from a previous build - conda remove --all -q -y -n %VIRTUALENV% - conda create -n %VIRTUALENV% -q -y python=%PYTHON_VERSION% numpy scipy cython matplotlib wheel pillow joblib - - call activate %VIRTUALENV% - - pip install threadpoolctl - - IF "%PYTEST_VERSION%"=="*" ( - pip install pytest - ) else ( - pip install pytest==%PYTEST_VERSION% - ) -) else ( - pip install numpy scipy cython pytest wheel pillow joblib threadpoolctl -) - -IF "%PYTEST_XDIST%" == "true" ( - pip install pytest-xdist -) - -if "%COVERAGE%" == "true" ( - pip install coverage codecov pytest-cov -) -python --version -pip --version - -@rem Install the build and runtime dependencies of the project. -python setup.py bdist_wheel bdist_wininst -b doc\logos\scikit-learn-logo.bmp - -@rem Install the generated wheel package to test it -pip install --pre --no-index --find-links dist\ scikit-learn - -if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/build_tools/azure/install_win.sh b/build_tools/azure/install_win.sh new file mode 100755 index 0000000000000..2c18d8a63da1f --- /dev/null +++ b/build_tools/azure/install_win.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -e +set -x + +if [[ "$PYTHON_ARCH" == "64" ]]; then + conda create -n $VIRTUALENV -q -y python=$PYTHON_VERSION numpy scipy cython matplotlib wheel pillow joblib + + source activate $VIRTUALENV + + pip install threadpoolctl + + if [[ "$PYTEST_VERSION" == "*" ]]; then + pip install pytest + else + pip install pytest==$PYTEST_VERSION + fi +else + pip install numpy scipy cython pytest wheel pillow joblib threadpoolctl +fi + +if [[ "$PYTEST_XDIST_VERSION" != "none" ]]; then + pip install pytest-xdist +fi + +if [[ "$COVERAGE" == "true" ]]; then + pip install coverage codecov pytest-cov +fi + +python --version +pip --version + +# Build scikit-learn +python setup.py bdist_wheel + +# Install the generated wheel package to test it +pip install --pre --no-index --find-links dist scikit-learn diff --git a/build_tools/azure/test_script.cmd b/build_tools/azure/test_script.cmd deleted file mode 100644 index c5f8d0e33889c..0000000000000 --- a/build_tools/azure/test_script.cmd +++ /dev/null @@ -1,24 +0,0 @@ -@echo on - -@rem Only 64 bit uses conda and uses a python newer than 3.5 -IF "%PYTHON_ARCH%"=="64" ( - call activate %VIRTUALENV% -) - -mkdir %TMP_FOLDER% -cd %TMP_FOLDER% - -if "%PYTEST_XDIST%" == "true" ( - set PYTEST_ARGS=%PYTEST_ARGS% -n2 -) - -if "%CHECK_WARNINGS%" == "true" ( - REM numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage - set PYTEST_ARGS=%PYTEST_ARGS% -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning -) - -if "%COVERAGE%" == "true" ( - set PYTEST_ARGS=%PYTEST_ARGS% --cov sklearn -) - -pytest --junitxml=%JUNITXML% --showlocals --durations=20 %PYTEST_ARGS% --pyargs sklearn diff --git a/build_tools/azure/upload_codecov.cmd b/build_tools/azure/upload_codecov.cmd deleted file mode 100644 index 6150b75a1ea54..0000000000000 --- a/build_tools/azure/upload_codecov.cmd +++ /dev/null @@ -1,10 +0,0 @@ -@echo on - -@rem Only 64 bit uses conda -IF "%PYTHON_ARCH%"=="64" ( - call activate %VIRTUALENV% -) - -copy %TMP_FOLDER%\.coverage %BUILD_REPOSITORY_LOCALPATH% - -codecov --root %BUILD_REPOSITORY_LOCALPATH% -t %CODECOV_TOKEN% diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 8a5edd4b93019..f835fd02cf58e 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -18,13 +18,14 @@ jobs: SKLEARN_SKIP_NETWORK_TESTS: '1' PYTEST_VERSION: '5.2.1' PYTEST_XDIST: 'true' - TMP_FOLDER: '$(Agent.WorkFolder)\tmp_folder' + PYTEST_XDIST_VERSION: 'latest' + TEST_DIR: '$(Agent.WorkFolder)/tmp_folder' strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} steps: - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python condition: eq(variables['PYTHON_ARCH'], '64') - task: UsePythonVersion@0 @@ -34,21 +35,18 @@ jobs: architecture: 'x86' displayName: Use 32 bit System Python condition: eq(variables['PYTHON_ARCH'], '32') - - script: | - build_tools\\azure\\install.cmd + - bash: ./build_tools/azure/install_win.sh displayName: 'Install' - - script: | - build_tools\\azure\\test_script.cmd + - bash: ./build_tools/azure/test_script.sh displayName: 'Test Library' - - script: | - build_tools\\azure\\upload_codecov.cmd + - bash: ./build_tools/azure/upload_codecov.sh condition: and(succeeded(), eq(variables['COVERAGE'], 'true')) displayName: 'Upload To Codecov' env: CODECOV_TOKEN: $(CODECOV_TOKEN) - task: PublishTestResults@2 inputs: - testResultsFiles: '$(TMP_FOLDER)\$(JUNITXML)' + testResultsFiles: '$(TEST_DIR)/$(JUNITXML)' testRunTitle: ${{ format('{0}-$(Agent.JobName)', parameters.name) }} displayName: 'Publish Test Results' condition: succeededOrFailed()