-
Notifications
You must be signed in to change notification settings - Fork 42
116 lines (103 loc) · 3.57 KB
/
python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Build python bindings
name: Build python bindings
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
os: [ 'macos-latest', 'ubuntu-22.04' ]
include:
# test sdist on ubuntu only
- os: ubuntu-22.04
python-version: '3.11'
sdist: true
build_direct: true
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} build
steps:
- name: install Linux deps
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
sudo apt-get install ccache
- name: install macOS deps
if: runner.os == 'macOS'
run: |
brew update
brew install zlib snappy boost
brew install ccache
- name: checkout from git
uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-python
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install python dependencies
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
python -m pip install -r python/requirements.txt
- name: build and test python extension
if: matrix.build_direct
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd python
python setup.py build --mode Release
python setup.py install --user
python -m pytest tests
python -m pytest integration-tests
python -m pip uninstall -y keyvi
- name: bdist
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd python
python setup.py bdist_wheel -d wheelhouse
- name: delocate
if: runner.os == 'macOS'
run: |
cd python
delocate-listdeps wheelhouse/keyvi*.whl
delocate-wheel wheelhouse/keyvi*.whl
delocate-listdeps wheelhouse/keyvi*.whl
- name: remove macos deps
if: runner.os == 'macOS'
run: |
brew remove zlib
brew remove --ignore-dependencies snappy
- name: bdist test
run: |
cd python
python -m pip install --user wheelhouse/*.whl
python -m pytest tests
python -m pip uninstall -y keyvi
- name: sdist
if: matrix.sdist
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd python
rm -rf wheelhouse
python setup.py sdist -d wheelhouse
python -m pip uninstall -y autowrap
python -m pip install wheelhouse/*.tar.gz -v
python -m pytest tests
python -m pip uninstall -y keyvi
- name: Publish package
if: ( matrix.sdist || runner.os == 'macOS' ) && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
PYPI_PASSWORD: ${{ secrets.pypi_password }}
run: |
python -m twine upload -u __token__ -p "${PYPI_PASSWORD}" python/wheelhouse/*