forked from NightTsarina/python-rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (95 loc) · 3.19 KB
/
dist.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
# vim:ts=2:sw=2:et:ai:sts=2
name: 'Build distribution'
on:
# Only run when pushing to main/merging PRs.
push:
branches:
- main
jobs:
build_wheels:
name: 'Build wheels'
runs-on: ${{ matrix.os }}
env:
LIBROCKSDB_PATH: /opt/rocksdb-${{ matrix.rocksdb_ver }}
strategy:
matrix:
os: [ubuntu-latest]
rocksdb_ver: ['v6.14.6']
steps:
- uses: actions/checkout@v2
name: 'Checkout source repository'
- uses: actions/setup-python@v2
name: 'Set up Python 3.9'
with:
python-version: '3.9'
- name: 'Install cibuildwheel'
run: |
python3 -m pip install cibuildwheel==1.7.1
- name: 'Build wheels'
run: |
python3 -m cibuildwheel --output-dir dist
env:
CIBW_MANYLINUX_X86_64_IMAGE: 'manylinux2014'
CIBW_BUILD: 'cp3*'
CIBW_SKIP: '*-manylinux_i686'
# Install python package and test-deps.
CIBW_TEST_REQUIRES: '.[test] pytest'
# Use `--pyargs` to interpret parameter as module to import, not as a
# path, and do not use `python3 -m pytest`. This way we prevent
# importing the module from the current directory instead of the
# installed package, and failing when it cannot find the shared
# library.
CIBW_TEST_COMMAND: 'pytest --pyargs rocksdb'
# Avoid re-building the C library in every iteration by testing for
# the build directory.
CIBW_BEFORE_BUILD: >
yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel
python3-Cython &&
test -d ${{ env.LIBROCKSDB_PATH }} || (
git clone https://github.com/facebook/rocksdb --depth 1
--branch ${{ matrix.rocksdb_ver }} ${{ env.LIBROCKSDB_PATH }} &&
cd ${{ env.LIBROCKSDB_PATH }} &&
CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4
) &&
pushd ${{ env.LIBROCKSDB_PATH }} &&
make install-shared &&
ldconfig &&
popd
- uses: actions/upload-artifact@v2
name: 'Upload build artifacts'
with:
path: 'dist/*.whl'
build_sdist:
name: 'Build source distribution'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
name: 'Checkout source repository'
- uses: actions/setup-python@v2
name: 'Set up Python 3.9'
with:
python-version: '3.9'
- name: 'Build sdist'
run: |
python3 setup.py sdist
- uses: actions/upload-artifact@v2
name: 'Upload build artifacts'
with:
path: 'dist/*.tar.gz'
# upload_pypi:
# name: 'Upload packages'
# needs: ['build_wheels', 'build_sdist']
# runs-on: 'ubuntu-latest'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# steps:
# - uses: actions/download-artifact@v2
# name: 'Download artifacts'
# with:
# name: 'artifact'
# path: 'dist'
#
# - uses: pypa/gh-action-pypi-publish@master
# name: 'Publish built packages'
# with:
# user: '__token__'
# password: '${{ secrets.PYPI_API_TOKEN }}'