4
4
push :
5
5
branches :
6
6
- master
7
+ tags :
8
+ - ' [0-9]+.[0-9]+.[0-9]+'
7
9
pull_request :
8
10
branches :
9
11
- master
@@ -40,16 +42,55 @@ jobs:
40
42
- os : windows-latest
41
43
python_version : ' 3.9'
42
44
python_arch : x86
45
+ container : ${{ matrix.os == 'ubuntu-latest' && 'quay.io/pypa/manylinux2014_x86_64' || '' }}
43
46
steps :
44
47
- name : Checkout repository
45
48
uses : actions/checkout@v2
46
49
with :
47
50
fetch-depth : 3
48
51
- name : Install Python
52
+ if : matrix.os != 'ubuntu-latest'
49
53
uses : actions/setup-python@v2
50
54
with :
51
55
python-version : ${{ matrix.python_version }}
52
56
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
53
94
- name : Check Python version
54
95
shell : python
55
96
run : |
@@ -65,3 +106,30 @@ jobs:
65
106
python setup.py install
66
107
- name : Run tests
67
108
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