diff --git a/.nuget/create_nuget.py b/.nuget/create_nuget.py new file mode 100644 index 000000000000..e68cfee8238e --- /dev/null +++ b/.nuget/create_nuget.py @@ -0,0 +1,39 @@ +import os +import sys +import distutils +from distutils import file_util + +if not os.path.exists("lib"): + os.makedirs("lib") +if not os.path.exists("lib/native"): + os.makedirs("lib/native") +if not os.path.exists("lib/net40"): + os.makedirs("lib/net40") +if not os.path.exists("lib/net45"): + os.makedirs("lib/net45") +distutils.file_util.copy_file("../Release/lightgbm.exe", "./lib/") +distutils.file_util.copy_file("../Release/lib_lightgbm.dll", "./lib/") +version = open('../VERSION.txt').read().strip() +nuget_str = ''' + + + LightGBM + %s + Guolin Ke + Guolin Ke + https://github.com/Microsoft/LightGBM/blob/master/LICENSE + https://github.com/Microsoft/LightGBM + false + A fast, distributed, high performance gradient boosting framework + Copyright 2017 @ Microsoft + machine-learning data-mining distributed native boosting gbdt + + + + + + +''' % (version) +nuget_file = open("LightGBM.nuspec", "w") +nuget_file.write(nuget_str) +nuget_file.close() diff --git a/.travis.yml b/.travis.yml index dd45c4e253b0..eb9199223d35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,3 +42,17 @@ script: notifications: email: false + +deploy: + provider: releases + api-key: + secure: "idU9Fb/yUz7VsVOEb0vGR8qqxcvXr4eh1tMzkKiMWLRx5XNeq7RCUzfKAPMIizFkML9zdMh/5vPtZ1Zs++3oWPpbZE2/o4CURoE+BvwDUyEDrKTdNSGoWgWZq0QLjfahj/PR8ObWlU+XCHqRQzKXlwbynwwUGRpOJrlEY0To5Kt9gTV5W8MxSlW7xFU2TTmMa499IZut38OuenJ3Nm9mTe6MCHFW4Y5uGp/gwNuBYfqzwUXDi6h/cJiJJD5drwtNnSneFZ2PZplrKxJxSJdSQ2aHttU+Wr8xogi9hLI/H6OA4UYCF69HrWOLSggplkZt6qUzaG7UfYyid4m6YbeKMUQRNBuGXhYVGr5qkyAzqXiOesGAef550346pWEZNGPLfNnKAwqPgkp8Q8tV9i0srjzyttqFAlLqhA76yST3kuX+QS0VGepSUTV+kkfxCaHZagxtX9Xve5RNybu4B44UmHWIGJnS6ijYpxWKwvWnMmBCIezFbZYyqsiXYC+9d5RfBgNFQ4PlRfmY0vnJlwUhx1AnyL9jsxnthwl9CNczo4mgBqnCSXxlhXNHz6ToMQuhgdhnqm5+qqJzI5/eUugxh8CW18qZTZBkrnL4DxEMm+bQ2QT8O07ZHrEDPKPXxQw7tBsphWvECetJ4DxXfNaf59GrY+eD6TFZuxurB5Vvo6s=" + file_glob: true + file: python-package/dist/*.whl + skip_cleanup: true + draft: true + tag_name: $TRAVIS_TAG + on: + condition: "$TASK = pip" + tags: true + all_branches: true diff --git a/.travis/test.sh b/.travis/test.sh index a088753956d6..3f945a8628fb 100644 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -39,6 +39,12 @@ if [[ ${TASK} == "pip" ]]; then cd $TRAVIS_BUILD_DIR/python-package && python setup.py sdist || exit -1 cd $TRAVIS_BUILD_DIR/python-package/dist && pip install lightgbm-$LGB_VER.tar.gz -v || exit -1 cd $TRAVIS_BUILD_DIR && pytest tests/python_package_test || exit -1 + if [[ $TRAVIS_OS_NAME == "osx" ]]; then + cd $TRAVIS_BUILD_DIR/python-package && python setup.py bdist_wheel --plat-name=macosx --universal || exit -1 + mv dist/lightgbm-${LGB_VER}-py2.py3-none-macosx.whl dist/lightgbm-${LGB_VER}-py2.py3-none-macosx_10_9_x86_64.macosx_10_10_x86_64.macosx_10_11_x86_64.macosx_10_12_x86_64.whl + else + cd $TRAVIS_BUILD_DIR/python-package && python setup.py bdist_wheel --plat-name=manylinux1_x86_64 --universal || exit -1 + fi exit 0 fi diff --git a/appveyor.yml b/appveyor.yml index 78a114835d0b..907d993231ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,21 +23,38 @@ test_script: - conda info -a - conda install --yes numpy scipy scikit-learn pandas matplotlib - pip install pep8 pytest - - cd python-package && python setup.py install --precompile && cd .. - pytest tests/c_api_test/test.py - - pytest tests/python_package_test - - pep8 --ignore=E501 --exclude=./compute,./docs . - "set /p LGB_VER=< VERSION.txt" - cd python-package && python setup.py sdist --formats gztar - cd dist - "pip install lightgbm-%LGB_VER%.tar.gz -v" - cd ../.. - pytest tests/python_package_test + - cd python-package && python setup.py bdist_wheel --plat-name=win-amd64 --universal + - cd ../.nuget + - python create_nuget.py + - nuget.exe pack LightGBM.nuspec nuget: project_feed: true + artifacts: - path: Release/lib_lightgbm.dll name: Library - path: Release/lightgbm.exe name: Exe +- path: python-package/dist/* + name: Pip +- path: .nuget/*.nupkg + name: Nuget + +deploy: + release: $(APPVEYOR_REPO_TAG_NAME) + provider: GitHub + auth_token: + secure: KR44XwtxY0cLlVpQwY726BvC6gzT0cYTf0ahJ4cSvvS0UVoSJxkR900ICfVXHRoT + artifact: Library,Exe,Pip,Nuget + force_update: true + draft: true + on: + appveyor_repo_tag: true diff --git a/python-package/setup.py b/python-package/setup.py index 578c93cbad23..e60e0071672b 100644 --- a/python-package/setup.py +++ b/python-package/setup.py @@ -108,6 +108,7 @@ version=version, description='LightGBM Python Package', install_requires=[ + 'wheel', 'numpy', 'scipy', 'scikit-learn'