Skip to content

Commit

Permalink
support release by CI
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Jun 25, 2017
1 parent 30aa3cf commit 282fd4e
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .nuget/create_nuget.py
Original file line number Diff line number Diff line change
@@ -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 = '''<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>LightGBM</id>
<version>%s</version>
<authors>Guolin Ke</authors>
<owners>Guolin Ke</owners>
<licenseUrl>https://github.com/Microsoft/LightGBM/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Microsoft/LightGBM</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A fast, distributed, high performance gradient boosting framework</description>
<copyright>Copyright 2017 @ Microsoft</copyright>
<tags>machine-learning data-mining distributed native boosting gbdt</tags>
<dependencies> </dependencies>
</metadata>
<files>
<file src="lib\**" target="lib"/>
</files>
</package>
''' % (version)
nuget_file = open("LightGBM.nuspec", "w")
nuget_file.write(nuget_str)
nuget_file.close()
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions .travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 20 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions python-package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
version=version,
description='LightGBM Python Package',
install_requires=[
'wheel',
'numpy',
'scipy',
'scikit-learn'
Expand Down

0 comments on commit 282fd4e

Please sign in to comment.