diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7c270c7b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +--- +name: CI + +on: [push, pull_request] + +jobs: + package: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python3.7 -m pip install setuptools wheel twine + - name: Build packages + run: | + python3.7 setup.py sdist bdist_wheel + - name: Check packages + run: | + set -exo pipefail; + if [ $(python3.7 -m twine check dist/* | grep -c 'warning') != 0 ]; then exit 1; fi + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python3.7 -m pip install tox + - name: Lint the code + run: tox -e lint + + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python3.7 -m pip install tox + - name: Build the docs + run: tox -e docs diff --git a/setup.cfg b/setup.cfg index 46231956..2c34451e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,3 +8,6 @@ universal = 1 [bdist_rpm] requires = python python-urllib3 + +[flake8] +ignore = E203, E266, E501, W503 diff --git a/tox.ini b/tox.ini index ad2333b6..c82359e2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,32 @@ [tox] -envlist = pypy,py27,py34,py35,py36,py37,py38 +envlist = pypy,py27,py34,py35,py36,py37,py38,lint,docs [testenv] whitelist_externals = git setenv = NOSE_XUNIT_FILE = junit-{envname}.xml commands = python setup.py test + +[testenv:lint] +deps = + flake8 + black +commands = + black --target-version=py27 \ + elasticsearch/ \ + test_elasticsearch/ \ + setup.py + black --target-version=py27 --check \ + elasticsearch/ \ + test_elasticsearch/ \ + setup.py + flake8 \ + elasticsearch/ \ + test_elasticsearch/ + +[testenv:docs] +deps = + sphinx + sphinx-rtd-theme +commands = + sphinx-build docs/ docs/_build -b html