From 1fcf030eb8adede0247e14c6f99d8005a9cef909 Mon Sep 17 00:00:00 2001 From: Jayson Reis Date: Sun, 10 Oct 2021 00:06:00 +0200 Subject: [PATCH] Move CI to GH --- .ci-before-script.sh | 9 +++++ .travis-runs-tests.sh => .ci-runs-tests.sh | 10 +++-- .github/workflows/tests-and-lint.yml | 33 +++++++++++++++++ .travis-before-script.sh | 14 ------- .vscode/settings.json | 3 ++ setup.py | 43 +++++++++++++--------- 6 files changed, 77 insertions(+), 35 deletions(-) create mode 100755 .ci-before-script.sh rename .travis-runs-tests.sh => .ci-runs-tests.sh (73%) create mode 100644 .github/workflows/tests-and-lint.yml delete mode 100755 .travis-before-script.sh create mode 100644 .vscode/settings.json diff --git a/.ci-before-script.sh b/.ci-before-script.sh new file mode 100755 index 0000000..190aaf3 --- /dev/null +++ b/.ci-before-script.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -ex + +if [ "$STEP" != "tests" ]; then + exit 0 +fi + +sudo apt-get update +sudo apt install memcached \ No newline at end of file diff --git a/.travis-runs-tests.sh b/.ci-runs-tests.sh similarity index 73% rename from .travis-runs-tests.sh rename to .ci-runs-tests.sh index 70b06a6..3e6f4fe 100755 --- a/.travis-runs-tests.sh +++ b/.ci-runs-tests.sh @@ -1,14 +1,18 @@ #!/bin/bash -set -e -set -x +set -ex +env if [ "$STEP" = "tests" ]; then - sudo service memcached stop py.test --version export PYTHONPATH=. python setup.py develop py.test --cov=bmemcached + exit 0 fi if [ "$STEP" = "lint" ]; then flake8 + exit 0 fi + +echo "Unknown step: $STEP" +exit 1 diff --git a/.github/workflows/tests-and-lint.yml b/.github/workflows/tests-and-lint.yml new file mode 100644 index 0000000..367c0b3 --- /dev/null +++ b/.github/workflows/tests-and-lint.yml @@ -0,0 +1,33 @@ +name: Tests and Lint + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [2.7, 3.6, 3.7, 3.8, 3.9] + step: + - tests + - lint + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_test.txt && python setup.py develop + STEP="${{ matrix.step}}" ./.ci-before-script.sh + - name: Run tests or lint + run: | + STEP="${{ matrix.step}}" ./.ci-runs-tests.sh diff --git a/.travis-before-script.sh b/.travis-before-script.sh deleted file mode 100755 index d2fd9ff..0000000 --- a/.travis-before-script.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -ex - -if [ "$STEP" != "tests" ]; then - exit 0 -fi - -sudo apt-get update -sudo apt-get remove memcached -sudo apt-get build-dep memcached -sudo apt-get install libssl-dev -wget https://memcached.org/files/memcached-1.5.21.tar.gz -tar zxvf memcached-1.5.21.tar.gz -pushd memcached-1.5.21 && ./configure --prefix=/usr --enable-tls && make && sudo make install && popd diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..de288e1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.formatting.provider": "black" +} \ No newline at end of file diff --git a/setup.py b/setup.py index 960eeb1..965d0b0 100644 --- a/setup.py +++ b/setup.py @@ -1,32 +1,39 @@ import os from setuptools import setup +import sys def read(filename): return open(os.path.join(os.path.dirname(__file__), filename)).read() +version_dependant_requirements = [ + "uhashring < 2" if sys.version_info < (3, 6) else "uhashring", # It uses f-strings +] + setup( - name='python-binary-memcached', - version='0.30.1', - author='Jayson Reis', - author_email='santosdosreis@gmail.com', - description='A pure python module to access memcached via its binary protocol with SASL auth support', - long_description='{0}\n{1}'.format(read('README.rst'), read('CHANGELOG.rst')), - url='https://github.com/jaysonsantos/python-binary-memcached', - packages=['bmemcached', 'bmemcached.client'], + name="python-binary-memcached", + version="0.30.1", + author="Jayson Reis", + author_email="santosdosreis@gmail.com", + description="A pure python module to access memcached via its binary protocol with SASL auth support", + long_description="{0}\n{1}".format(read("README.rst"), read("CHANGELOG.rst")), + url="https://github.com/jaysonsantos/python-binary-memcached", + packages=["bmemcached", "bmemcached.client"], classifiers=[ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ], install_requires=[ - 'six', - 'uhashring', + "six", ] + + version_dependant_requirements, )