diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98d2d27629c6f62219f1abf4cdf5043b0308e660..7c313b8c329efa1cb2cc4e38005107bd8f43f0d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,37 +1,77 @@ -name: "Build" +# vim:ts=2:sw=2:et:ai:sts=2 +name: 'Build' on: ['push', 'pull_request'] jobs: + test: + name: 'Test' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + #py_ver: ['3.7', '3.8', '3.9'] + #rocksdb_ver: ['v6.14.6', 'v6.11.4', 'v5.17.2'] + py_ver: ['3.9'] + rocksdb_ver: ['v6.14.6'] + + steps: + - uses: actions/checkout@v2 + name: 'Checkout source repository' + + - uses: actions/setup-python@v2 + name: 'Set up Python ${{ matrix.py_ver }}' + with: + python-version: ${{ matrix.py_ver }} + + - name: 'Install dependencies' + run: | + sudo apt install -y libsnappy-dev libbz2-dev liblz4-dev libz-dev libgflags-dev libzstd-dev python3-pytest + + - name: 'Install RocksDB ${{ matrix.rocksdb_ver }}' + run: | + pushd /opt + git clone https://github.com/facebook/rocksdb + cd rocksdb + git reset --hard ${{ matrix.rocksdb_ver }} + CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4 + make shared_lib + sudo make install-shared + popd + + - name: Test with pytest + run: | + pytest-3 rocksdb/tests + build_wheels: - name: "Build wheels" - runs-on: 'ubuntu-latest' + name: 'Build wheels' + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: "Checkout source repository" + name: 'Checkout source repository' - uses: actions/setup-python@v2 - name: "Set up Python 3.9" + name: 'Set up Python 3.9' with: python-version: '3.9' - - name: "Install cibuildwheel" + - name: 'Install cibuildwheel' run: | python3 -m pip install cibuildwheel==1.7.1 - - name: "Build wheels" + - name: 'Build wheels' run: | python3 -m cibuildwheel --output-dir dist env: - ROCKSDB_VERSION: '6.14.6' + ROCKSDB_VERSION: 'v6.14.6' CIBW_MANYLINUX_X86_64_IMAGE: 'manylinux2014' - CIBW_BUILD: 'cp37-manylinux* cp38-manylinux* cp39-manylinux*' + CIBW_BUILD: 'cp3*' CIBW_SKIP: '*-manylinux_i686' CIBW_TEST_REQUIRES: '.[test]' - CIBW_TEST_COMMAND: 'rm {project}/rocksdb/tests/__init__.py; pytest {project}/rocksdb/tests' + CIBW_TEST_COMMAND: 'pytest {project}/rocksdb/tests' CIBW_BEFORE_BUILD: | - yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel + apt install -y libsnappy-dev libbz2-dev liblz4-dev libz-dev python3-pytest pushd /opt git clone https://github.com/facebook/rocksdb cd rocksdb @@ -41,47 +81,47 @@ jobs: popd - uses: actions/upload-artifact@v2 - name: "Upload build artifacts" + name: 'Upload build artifacts' with: path: 'dist/*.whl' build_sdist: - name: "Build source distribution" + name: 'Build source distribution' runs-on: 'ubuntu-latest' steps: - uses: actions/checkout@v2 - name: "Checkout source repository" + name: 'Checkout source repository' - uses: actions/setup-python@v2 - name: "Set up Python 3.9" + name: 'Set up Python 3.9' with: python-version: '3.9' - - name: "Build sdist" + - name: 'Build sdist' run: | python3 setup.py sdist - uses: actions/upload-artifact@v2 - name: "Upload build artifacts" + 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 }}" +# 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 }}'