44 push :
55 branches :
66 - master
7+ tags :
8+ - ' [0-9]+.[0-9]+.[0-9]+'
79 pull_request :
810 branches :
911 - master
@@ -40,16 +42,55 @@ jobs:
4042 - os : windows-latest
4143 python_version : ' 3.9'
4244 python_arch : x86
45+ container : ${{ matrix.os == 'ubuntu-latest' && 'quay.io/pypa/manylinux2014_x86_64' || '' }}
4346 steps :
4447 - name : Checkout repository
4548 uses : actions/checkout@v2
4649 with :
4750 fetch-depth : 3
4851 - name : Install Python
52+ if : matrix.os != 'ubuntu-latest'
4953 uses : actions/setup-python@v2
5054 with :
5155 python-version : ${{ matrix.python_version }}
5256 architecture : ${{ matrix.python_arch }}
57+ - name : Set environment variables
58+ shell : bash
59+ run : |
60+ PY_TAG=${{ matrix.python_version }}
61+ PY_TAG="${PY_TAG//.}"
62+ if [[ $PY_TAG -lt 38 ]]; then
63+ PY_TAG_FULL="cp${PY_TAG}-cp${PY_TAG}m"
64+ else
65+ PY_TAG_FULL="cp${PY_TAG}-cp${PY_TAG}"
66+ fi
67+ if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
68+ PLAT_NAME=manylinux2014_x86_64
69+ elif [[ ${{ matrix.os }} == "windows-latest" ]]; then
70+ if [[ ${{ matrix.python_arch }} == "x64" ]]; then
71+ PLAT_NAME=win_amd64
72+ else
73+ PLAT_NAME=win32
74+ fi
75+ else
76+ PLAT_NAME=macosx_10_9_x86_64
77+ fi
78+ PACKAGE_VERSION=$(python -c "import lightning;print(lightning.__version__)")
79+ echo "PY_TAG=$PY_TAG" >> $GITHUB_ENV
80+ echo "PY_TAG_FULL=$PY_TAG_FULL" >> $GITHUB_ENV
81+ echo "PLAT_NAME=$PLAT_NAME" >> $GITHUB_ENV
82+ echo "PACKAGE_NAME=sklearn_contrib_lightning" >> $GITHUB_ENV
83+ echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
84+ - name : Modify PATH variable
85+ if : matrix.os == 'ubuntu-latest'
86+ run : echo "/opt/python/${{ env.PY_TAG_FULL }}/bin" >> $GITHUB_PATH
87+ - name : Check Python location
88+ if : matrix.os == 'ubuntu-latest'
89+ shell : bash
90+ run : |
91+ if [[ $(which python) != "/opt/python/${{ env.PY_TAG_FULL }}/bin/python" ]]; then
92+ exit -1
93+ fi
5394 - name : Check Python version
5495 shell : python
5596 run : |
@@ -65,3 +106,30 @@ jobs:
65106 python setup.py install
66107 - name : Run tests
67108 run : pytest -v --pyargs lightning
109+ - name : Create archive with sources
110+ if : matrix.os == 'ubuntu-latest' && matrix.python_version == '3.9' && startsWith(github.ref, 'refs/tags/')
111+ run : python setup.py sdist
112+ - name : Create wheels
113+ if : startsWith(github.ref, 'refs/tags/')
114+ run : |
115+ pip install wheel
116+ python setup.py bdist_wheel --python-tag="cp${{ env.PY_TAG }}" --plat-name=${{ env.PLAT_NAME }}
117+ - name : Run auditwheel
118+ if : matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
119+ run : |
120+ pip install auditwheel
121+ auditwheel repair --plat ${{ env.PLAT_NAME }} dist/${{ env.PACKAGE_NAME }}*.whl
122+ mv -f wheelhouse/${{ env.PACKAGE_NAME }}*.whl dist/${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-${{ env.PY_TAG_FULL }}-${{ env.PLAT_NAME }}.whl
123+ - name : Create GitHub Release
124+ if : startsWith(github.ref, 'refs/tags/')
125+ uses : softprops/action-gh-release@v1
126+ env :
127+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128+ with :
129+ tag_name : ${{ env.PACKAGE_VERSION }}
130+ name : ${{ env.PACKAGE_VERSION }}
131+ draft : true
132+ prerelease : false
133+ files : |
134+ dist/${{ env.PACKAGE_NAME }}*.whl
135+ dist/*.tar.gz
0 commit comments