diff --git a/.travis.yml b/.travis.yml index 2735c2ba0..915d3dc6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,21 +5,35 @@ notifications: email: false python: -- 3.5.3 -- 3.6.1 +- 3.6.5 +- 3.5.2 +env: + global: + PIPENV_IGNORE_VIRTUALENVS=1 + matrix: + # This is the environment for the main test jobs. + # This will run for all above specified versions of python + TOXENV=py + install: -- echo "git+https://github.com/Rapptz/discord.py.git@rewrite#egg=discord.py[voice]" >> requirements.txt -- pip install -r requirements.txt -- pip install .[test] +- pip install --upgrade pip pipenv +- pipenv install --skip-lock --dev + script: -- python -m compileall ./redbot/cogs -- python -m pytest +- pipenv run tox jobs: include: + # These jobs occur in parallel with the main test job + - python: 3.6.5 + env: TOXENV=docs + - python: 3.6.5 + env: TOXENV=style + + # These jobs only occur on tag creation for V3/develop if the prior ones succeed - stage: PyPi Deployment if: tag IS present - python: 3.5.3 + python: 3.6.5 env: - DEPLOYING=true deploy: @@ -35,10 +49,10 @@ jobs: tags: true - stage: Crowdin Deployment if: tag IS present - python: 3.5.3 + python: 3.6.5 env: - DEPLOYING=true - before_deployment: + before_deploy: - curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add - - echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list - sudo apt-get update -qq diff --git a/Pipfile b/Pipfile index b3d98a346..91db1358c 100644 --- a/Pipfile +++ b/Pipfile @@ -8,8 +8,13 @@ name = "pypi" "e1839a8" = {path = ".", editable = true} [dev-packages] +tox = "*" pytest = "*" pytest-asyncio = "*" sphinx = ">1.7" sphinxcontrib-asyncio = "*" sphinx-rtd-theme = "*" +black = {version = "*", python_version = ">= '3.6'"} + +[pipenv] +allow_prereleases = true diff --git a/Pipfile.lock b/Pipfile.lock index 9ee4b2105..9ea1d9496 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "411f8c9337f628fce64779f2e6ea4a59ec5b19e9cf6fcb1a264cda57805e129d" + "sha256": "d340e4a19777736703970e45766d05d67b973db38b87382b6ef8696cb53abb60" }, "pipfile-spec": 6, "requires": {}, @@ -192,6 +192,13 @@ ], "version": "==0.7.10" }, + "appdirs": { + "hashes": [ + "sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92", + "sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e" + ], + "version": "==1.4.3" + }, "attrs": { "hashes": [ "sha256:4b90b09eeeb9b88c35bc642cbac057e45a5fd85367b985bd2809c62b7b939265", @@ -206,6 +213,15 @@ ], "version": "==2.5.3" }, + "black": { + "hashes": [ + "sha256:58594128efb5d21f359c8680911241985e627eb3505397f3982ffbae914d8202", + "sha256:dfb0e344587510ef662785f4a8991addb4017840459bb6d1d53d344ab0f10300" + ], + "index": "pypi", + "markers": "python_version >= '3.6'", + "version": "==18.4a4" + }, "certifi": { "hashes": [ "sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7", @@ -220,6 +236,13 @@ ], "version": "==3.0.4" }, + "click": { + "hashes": [ + "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d", + "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" + ], + "version": "==6.7" + }, "docutils": { "hashes": [ "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", @@ -378,12 +401,27 @@ ], "version": "==1.0.1" }, + "tox": { + "hashes": [ + "sha256:96efa09710a3daeeb845561ebbe1497641d9cef2ee0aea30db6969058b2bda2f", + "sha256:9ee7de958a43806402a38c0d2aa07fa8553f4d2c20a15b140e9f771c2afeade0" + ], + "index": "pypi", + "version": "==3.0.0" + }, "urllib3": { "hashes": [ "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" ], "version": "==1.22" + }, + "virtualenv": { + "hashes": [ + "sha256:1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54", + "sha256:e8e05d4714a1c51a2f5921e62f547fcb0f713ebbe959e0a7f585cc8bef71d11f" + ], + "version": "==15.2.0" } } } diff --git a/setup.py b/setup.py index 13c9caaf1..221b89c10 100644 --- a/setup.py +++ b/setup.py @@ -115,5 +115,6 @@ setup( "mongo": ["motor"], "docs": ["sphinx>=1.7", "sphinxcontrib-asyncio", "sphinx_rtd_theme"], "voice": ["red-lavalink>=0.0.4"], + "style": ["black"], }, ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..2252a141e --- /dev/null +++ b/tox.ini @@ -0,0 +1,37 @@ +# tox (https://tox.readthedocs.io/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = + py35 + py36 + docs + dev + +[testenv] +description = Run unit tests with pytest +extras = voice, test, mongo +deps = + https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py[voice] + -rrequirements.txt +commands = + python -m compileall ./redbot/cogs + pytest + +[testenv:docs] +description = Attempt to build docs with sphinx-build +whitelist_externals = sphinx-build +basepython = python3.6 +extras = voice, docs, mongo +commands = + sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" -W -bhtml + sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" -W -blinkcheck + +[testenv:style] +description = Stylecheck the code with black to see if anything needs changes. +basepython = python3.6 +extras = style +commands = + black -l 99 --check generate_strings.py setup.py tests redbot