Skip to content
Snippets Groups Projects
Commit 2f942de6 authored by Martina Ferrari's avatar Martina Ferrari
Browse files

Rework caching and building librocksdb.

Following suggestions from code review, this commit avoid re-using the working
directory from different versions of the library.
parent 9cbbea67
No related branches found
No related tags found
No related merge requests found
# vim:ts=2:sw=2:et:ai:sts=2
name: 'Build'
on: ['push', 'pull_request']
on:
push:
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]
......@@ -18,10 +21,7 @@ jobs:
id: cache-librocksdb
with:
key: ${{ matrix.os }}-librocksdb-${{ matrix.rocksdb_ver }}
path: /opt/rocksdb
restore-keys: |
librocksdb-${{ matrix.os }}-
librocksdb-
path: ${{ env.LIBROCKSDB_PATH }}
- name: 'Install dependencies'
if: steps.cache-librocksdb.outputs.cache-hit != 'true'
......@@ -31,19 +31,19 @@ jobs:
- name: 'Clone & build RocksDB ${{ matrix.rocksdb_ver }}'
if: steps.cache-librocksdb.outputs.cache-hit != 'true'
run: |
pushd /opt &&
git clone https://github.com/facebook/rocksdb &&
cd rocksdb &&
git reset --hard ${{ matrix.rocksdb_ver }} &&
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 &&
make shared_lib &&
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]
......@@ -71,13 +71,13 @@ jobs:
id: cache-librocksdb
with:
key: ${{ matrix.os }}-librocksdb-${{ matrix.rocksdb_ver }}
path: /opt/rocksdb
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 /opt/rocksdb &&
pushd ${{ env.LIBROCKSDB_PATH }} &&
sudo make install-shared &&
sudo ldconfig &&
popd
......
......@@ -10,7 +10,13 @@ on:
jobs:
build_wheels:
name: 'Build wheels'
runs-on: ubuntu-latest
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
......@@ -29,7 +35,6 @@ jobs:
run: |
python3 -m cibuildwheel --output-dir dist
env:
ROCKSDB_VERSION: 'v6.14.6'
CIBW_MANYLINUX_X86_64_IMAGE: 'manylinux2014'
CIBW_BUILD: 'cp3*'
CIBW_SKIP: '*-manylinux_i686'
......@@ -46,14 +51,15 @@ jobs:
CIBW_BEFORE_BUILD: >
yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel
python3-Cython &&
pushd /opt &&
test -d rocksdb || (
git clone https://github.com/facebook/rocksdb &&
cd rocksdb &&
git reset --hard $ROCKSDB_VERSION &&
CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4 &&
make install-shared
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment