Skip to content

Commit

Permalink
Fix deploy (#2337)
Browse files Browse the repository at this point in the history
* Work on deploy

Set strict mode for bash files
Drop non-aiohttp wheels from dist

* Make tests pass
  • Loading branch information
asvetlov authored Oct 17, 2017
1 parent 96412ae commit 3b39eb3
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 31 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
- docker
script:
- ./tools/run_docker.sh "aiohttp"
- find dist -not -name "*aiohttp*" -delete
deploy:
provider: pypi
# `skip_cleanup: true` is required to preserve binary wheels, built
Expand Down
23 changes: 23 additions & 0 deletions requirements/ci-wheel.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pip==9.0.1
flake8==3.4.1
pyflakes==1.6.0
coverage==4.4.1
cchardet==2.1.1
cython==0.27.1
chardet==3.0.4
isort==4.2.15
tox==2.9.1
multidict==3.3.0
async-timeout==2.0.0
pytest==3.2.3
pytest-cov==2.5.1
pytest-mock==1.6.3
gunicorn==19.7.1
twine==1.9.1
yarl==0.13.0
brotlipy==0.7.0

# Using PEP 508 env markers to control dependency on runtimes:
aiodns==1.1.1; platform_system!="Windows" # required c-ares will not build on windows
codecov==2.0.9; platform_system!="Windows" # We only use it in Travis CI
uvloop==0.8.1; python_version>="3.5" and platform_system!="Windows" # MagicStack/uvloop#14
24 changes: 1 addition & 23 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
setuptools-git==1.2

-r doc.txt
pip==9.0.1
flake8==3.4.1
pyflakes==1.6.0
coverage==4.4.1
cchardet==2.1.1
cython==0.27.1
chardet==3.0.4
isort==4.2.15
tox==2.9.1
multidict==3.3.0
async-timeout==2.0.0
pytest==3.2.3
pytest-cov==2.5.1
pytest-mock==1.6.3
gunicorn==19.7.1
twine==1.9.1
yarl==0.13.0
brotlipy==0.7.0
-r ci-wheel.txt
-e .

# Using PEP 508 env markers to control dependency on runtimes:
aiodns==1.1.1; platform_system!="Windows" # required c-ares will not build on windows
codecov==2.0.9; platform_system!="Windows" # We only use it in Travis CI
uvloop==0.8.1; python_version>="3.5" and platform_system!="Windows" # MagicStack/uvloop#14
16 changes: 10 additions & 6 deletions tests/test_worker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for aiohttp/worker.py"""
import asyncio
import os
import pathlib
import socket
import ssl
Expand Down Expand Up @@ -217,8 +218,9 @@ def test__run_ok(worker, loop):
yield from worker._run()

worker.notify.assert_called_with()
worker.log.info.assert_called_with("Parent changed, shutting down: %s",
worker)
if os.getppid() != 1: # not Docker
worker.log.info.assert_called_with("Parent changed, shutting down: %s",
worker)

args, kwargs = loop.create_server.call_args
assert 'ssl' in kwargs
Expand Down Expand Up @@ -257,8 +259,9 @@ def test__run_ok_unix_socket(worker, loop):
yield from worker._run()

worker.notify.assert_called_with()
worker.log.info.assert_called_with("Parent changed, shutting down: %s",
worker)
if os.getppid() != 1: # not Docker
worker.log.info.assert_called_with("Parent changed, shutting down: %s",
worker)

args, kwargs = loop.create_unix_server.call_args
assert 'ssl' in kwargs
Expand Down Expand Up @@ -374,8 +377,9 @@ def test__run_ok_no_max_requests(worker, loop):
yield from worker._run()

worker.notify.assert_called_with()
worker.log.info.assert_called_with("Parent changed, shutting down: %s",
worker)
if os.getppid() != 1: # not Docker
worker.log.info.assert_called_with("Parent changed, shutting down: %s",
worker)

args, kwargs = loop.create_server.call_args
assert 'ssl' in kwargs
Expand Down
6 changes: 6 additions & 0 deletions tools/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -e

PYTHON_VERSIONS="cp34-cp34m cp35-cp35m cp36-cp36m"

# Avoid creation of __pycache__/*.py[c|o]
Expand Down Expand Up @@ -42,6 +44,10 @@ for PYTHON in ${PYTHON_VERSIONS}; do
echo
echo -n "Test $PYTHON: "
/opt/python/${PYTHON}/bin/python -c "import platform;print(platform.platform())"
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/ci-wheel.txt
/opt/python/${PYTHON}/bin/pip install "$package_name" --no-index -f file:///io/dist
/opt/python/${PYTHON}/bin/py.test /io/tests

# clear python cache
find /io -name __pycache__ | xargs rm -rf
done
6 changes: 5 additions & 1 deletion tools/run_docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -e

package_name="$1"
if [ -z "$package_name" ]
then
Expand All @@ -17,7 +19,7 @@ do
done

echo Creating dist folder with privileges of host-machine user
mkdir dist # This is required to be created with host-machine user privileges
mkdir -p dist # This is required to be created with host-machine user privileges

for arch in x86_64 i686
do
Expand All @@ -33,3 +35,5 @@ do

dock_ext_args="" # Reset docker args, just in case
done

find dist -type f -not -name "*aiohttp*" | xargs rm -f

0 comments on commit 3b39eb3

Please sign in to comment.