This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
106 lines (93 loc) · 3.47 KB
/
build.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
# vim:ts=2:sw=2:et:ai:sts=2
name: 'Build'
on:
pull_request:
push:
branches:
- 'master'
- 'force_ci/all/**' # For development, forcing all workflows to run.
- 'force_ci/build/**' # For debugging and/or only forcing this workflow.
jobs:
# Build the RocksDB C library and cache the result.
librocksdb:
name: 'Build librocksdb'
runs-on: ${{ matrix.os }}
env:
LIBROCKSDB_PATH: /opt/rocksdb-${{ matrix.rocksdb_ver }}
strategy:
matrix:
os: [ubuntu-latest]
rocksdb_ver: ['v6.29.3', 'v6.25.3', 'v6.14.6']
steps:
- uses: actions/cache@v2
id: cache-librocksdb
with:
key: ${{ matrix.os }}-librocksdb-${{ matrix.rocksdb_ver }}
path: ${{ env.LIBROCKSDB_PATH }}
- name: 'Install dependencies'
if: steps.cache-librocksdb.outputs.cache-hit != 'true'
run: >
sudo apt install -y libsnappy-dev libbz2-dev liblz4-dev libz-dev
libgflags-dev libzstd-dev
- name: 'Clone & build RocksDB ${{ matrix.rocksdb_ver }}'
if: steps.cache-librocksdb.outputs.cache-hit != 'true'
run: >
git clone https://github.com/facebook/rocksdb --depth 1
--branch ${{ matrix.rocksdb_ver }} ${{ env.LIBROCKSDB_PATH }} &&
pushd ${{ env.LIBROCKSDB_PATH }} &&
CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4 &&
popd
test:
name: 'Build and test python-rocksdb'
needs: librocksdb
runs-on: ${{ matrix.os }}
env:
LIBROCKSDB_PATH: /opt/rocksdb-${{ matrix.rocksdb_ver }}
strategy:
matrix:
os: [ubuntu-latest]
py_ver: ['3.7', '3.8', '3.9', '3.10', '3.11']
rocksdb_ver: ['v6.29.3', 'v6.25.3', 'v6.14.6']
steps:
- uses: actions/checkout@v3
name: 'Checkout source repository'
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: 'Set up Python ${{ matrix.py_ver }}'
with:
python-version: ${{ matrix.py_ver }}
- name: 'Install C libraries'
# XXX(Tina): The non-development versions are sufficient, but package
# names are difficult to predict.
run: >
sudo apt install -y libsnappy-dev libbz2-dev liblz4-dev libz-dev
libgflags-dev libzstd-dev
# Recover the pre-built C library.
- uses: actions/cache@v2
id: cache-librocksdb
with:
key: ${{ matrix.os }}-librocksdb-${{ matrix.rocksdb_ver }}
path: ${{ env.LIBROCKSDB_PATH }}
- name: 'Install RocksDB ${{ matrix.rocksdb_ver }}'
if: steps.cache-librocksdb.outputs.cache-hit == 'true'
# DO NOT FORGET to call `ldconfig`!
run: |
pushd ${{ env.LIBROCKSDB_PATH }} &&
sudo make install-shared &&
sudo ldconfig &&
popd
- name: Build and install python-rocksdb
# Use `pip install` instead of `setup.py` so build-dependencies from
# `pyproject.toml` are installed, in particular `Cython`, without which
# the build fails in confusing ways.
run: |
python3 -m pip install '.[test]'
- name: Run tests
# 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.
run: |
pytest --pyargs rocksdb