From 1a561e118ce2064dd4f1b3fdf0217f8e8dce4616 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 14 Oct 2020 17:44:58 +0200 Subject: [PATCH 01/19] Run some version tests after building the image After the image is built from the current commit, we spin up the container with the image just built and execute some commands to check the versions them. --- .travis.yml | 5 ++-- tests/test_versions.py | 59 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 tests/test_versions.py diff --git a/.travis.yml b/.travis.yml index 3d37267..0fd9371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,10 @@ before_install: install: - pipenv install script: - - pipenv run pytest - - docker build . + - docker build -t readthedocs/build:master . + - pipenv run pytest -m master branches: only: - master + - releases/6.x diff --git a/tests/test_versions.py b/tests/test_versions.py new file mode 100644 index 0000000..e734abd --- /dev/null +++ b/tests/test_versions.py @@ -0,0 +1,59 @@ +import pytest +from docker import APIClient + + +@pytest.mark.parametrize( + 'container_image,command,expected_output', + [ + # TODO: add other Docker images as well + # python + ('readthedocs/build:6.0', 'python2 --version', 'Python 2.7.16'), + ('readthedocs/build:6.0', 'python3.5 --version', 'Python 3.5.7'), + ('readthedocs/build:6.0', 'python3.6 --version', 'Python 3.6.8'), + ('readthedocs/build:6.0', 'python3.7 --version', 'Python 3.7.3'), + ('readthedocs/build:6.0', 'python3.8 --version', 'Python 3.8.0'), + # pip + ('readthedocs/build:6.0', 'python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.7/lib/python3.5/site-packages/pip (python 3.5)"), + ('readthedocs/build:6.0', 'python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip (python 3.6)"), + ('readthedocs/build:6.0', 'python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip (python 3.7)"), + ('readthedocs/build:6.0', 'python3.8 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pip (python 3.8)"), + # virtualenv + ('readthedocs/build:6.0', 'virtualenv --version', '16.7.9'), + # others + ('readthedocs/build:6.0', 'node --version', 'v8.10.0'), + ('readthedocs/build:6.0', 'npm --version', '3.5.2'), + ('readthedocs/build:6.0', 'conda --version', 'conda 4.6.14'), + ] +) +def test_python_versions(container_image, command, expected_output): + client = APIClient() + + # Create the container + container = client.create_container( + image=container_image, + command=( + '/bin/sh -c "sleep {time}; exit {exit}"'.format( + time=60, + exit=42, + ) + ), + detach=True, + user='docs', + ) + + # Start the container + container_id = container.get('Id') + client.start(container=container_id) + + # Execute commands to verify versions + exec_cmd = client.exec_create( + container=container_id, + cmd=f"/bin/sh -c '{command}'", + stdout=True, + stderr=True, + ) + cmd_output = client.exec_start(exec_id=exec_cmd['Id'], stream=False) + cmd_output = cmd_output.decode('utf-8', 'replace').strip() + client.kill(container_id) + + assert cmd_output == expected_output From 6bc34aaedf359e5b6c18a279674915be64187ad0 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 14 Oct 2020 18:40:29 +0200 Subject: [PATCH 02/19] Install docker for tests --- Pipfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index f9273b9..6f7e6af 100644 --- a/Pipfile +++ b/Pipfile @@ -9,4 +9,6 @@ name = "pypi" "dockerfile-parse" = "*" requests = "*" -pytest = "*" \ No newline at end of file +pytest = "*" +pytest-custom-exit-code = "*" +docker = "*" From 98eacf6da03b809a8488c2381c2c0c77cc8ee780 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 14 Oct 2020 18:48:16 +0200 Subject: [PATCH 03/19] Update Python version to match latest ones --- tests/test_versions.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index e734abd..af96010 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -7,11 +7,12 @@ [ # TODO: add other Docker images as well # python - ('readthedocs/build:6.0', 'python2 --version', 'Python 2.7.16'), - ('readthedocs/build:6.0', 'python3.5 --version', 'Python 3.5.7'), - ('readthedocs/build:6.0', 'python3.6 --version', 'Python 3.6.8'), - ('readthedocs/build:6.0', 'python3.7 --version', 'Python 3.7.3'), - ('readthedocs/build:6.0', 'python3.8 --version', 'Python 3.8.0'), + ('readthedocs/build:6.0', 'python2 --version', 'Python 2.7.18'), + ('readthedocs/build:6.0', 'python3.5 --version', 'Python 3.5.10'), + ('readthedocs/build:6.0', 'python3.6 --version', 'Python 3.6.12'), + ('readthedocs/build:6.0', 'python3.7 --version', 'Python 3.7.9'), + ('readthedocs/build:6.0', 'python3.8 --version', 'Python 3.8.8'), + ('readthedocs/build:6.0', 'pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip ('readthedocs/build:6.0', 'python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.7/lib/python3.5/site-packages/pip (python 3.5)"), ('readthedocs/build:6.0', 'python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip (python 3.6)"), From 146c370702075cb41a518d00644affff81090b91 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 14 Oct 2020 18:48:38 +0200 Subject: [PATCH 04/19] Check setuptools version on all Python versions --- tests/test_versions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_versions.py b/tests/test_versions.py index af96010..3dc30f0 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -18,6 +18,12 @@ ('readthedocs/build:6.0', 'python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip (python 3.6)"), ('readthedocs/build:6.0', 'python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip (python 3.7)"), ('readthedocs/build:6.0', 'python3.8 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pip (python 3.8)"), + # setuptools + ('readthedocs/build:6.0', 'python2 -c "import setuptools; print(setuptools.__version__)"', "44.4.0"), + ('readthedocs/build:6.0', 'python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('readthedocs/build:6.0', 'python3.6 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('readthedocs/build:6.0', 'python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('readthedocs/build:6.0', 'python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), # virtualenv ('readthedocs/build:6.0', 'virtualenv --version', '16.7.9'), # others From 878716b041679f4f04222a8a188a01c8cc826d18 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 10:10:06 +0200 Subject: [PATCH 05/19] Refactor to isolate 'run_commnd_in_container' and re-use it --- tests/test_versions.py | 80 +++++++++++++++--------------------------- tests/utils.py | 37 +++++++++++++++++++ 2 files changed, 66 insertions(+), 51 deletions(-) create mode 100644 tests/utils.py diff --git a/tests/test_versions.py b/tests/test_versions.py index 3dc30f0..5e6e19a 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -1,66 +1,44 @@ import pytest from docker import APIClient +from .utils import run_command_in_container + +@pytest.mark.image_60 @pytest.mark.parametrize( - 'container_image,command,expected_output', + 'command,expected_output', [ # TODO: add other Docker images as well # python - ('readthedocs/build:6.0', 'python2 --version', 'Python 2.7.18'), - ('readthedocs/build:6.0', 'python3.5 --version', 'Python 3.5.10'), - ('readthedocs/build:6.0', 'python3.6 --version', 'Python 3.6.12'), - ('readthedocs/build:6.0', 'python3.7 --version', 'Python 3.7.9'), - ('readthedocs/build:6.0', 'python3.8 --version', 'Python 3.8.8'), - ('readthedocs/build:6.0', 'pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), + ('python2 --version', 'Python 2.7.18'), + ('python3.5 --version', 'Python 3.5.10'), + ('python3.6 --version', 'Python 3.6.12'), + ('python3.7 --version', 'Python 3.7.9'), + ('python3.8 --version', 'Python 3.8.6'), + ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip - ('readthedocs/build:6.0', 'python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.7/lib/python3.5/site-packages/pip (python 3.5)"), - ('readthedocs/build:6.0', 'python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip (python 3.6)"), - ('readthedocs/build:6.0', 'python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip (python 3.7)"), - ('readthedocs/build:6.0', 'python3.8 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pip (python 3.8)"), + ('python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), + ('python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), + ('python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), + ('python3.8 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip (python 3.8)"), # setuptools - ('readthedocs/build:6.0', 'python2 -c "import setuptools; print(setuptools.__version__)"', "44.4.0"), - ('readthedocs/build:6.0', 'python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), - ('readthedocs/build:6.0', 'python3.6 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), - ('readthedocs/build:6.0', 'python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), - ('readthedocs/build:6.0', 'python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python2 -c "import setuptools; print(setuptools.__version__)"', "44.0.0"), + ('python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python3.6 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), # virtualenv - ('readthedocs/build:6.0', 'virtualenv --version', '16.7.9'), + ('python2 -m virtualenv --version', '16.7.9'), + ('python3.5 -m virtualenv --version', '16.7.9'), + ('python3.6 -m virtualenv --version', '16.7.9'), + ('python3.7 -m virtualenv --version', '16.7.9'), + ('python3.8 -m virtualenv --version', '16.7.9'), # others - ('readthedocs/build:6.0', 'node --version', 'v8.10.0'), - ('readthedocs/build:6.0', 'npm --version', '3.5.2'), - ('readthedocs/build:6.0', 'conda --version', 'conda 4.6.14'), + ('node --version', 'v8.10.0'), + ('npm --version', '3.5.2'), + ('conda --version', 'conda 4.6.14'), ] ) -def test_python_versions(container_image, command, expected_output): - client = APIClient() - - # Create the container - container = client.create_container( - image=container_image, - command=( - '/bin/sh -c "sleep {time}; exit {exit}"'.format( - time=60, - exit=42, - ) - ), - detach=True, - user='docs', - ) - - # Start the container - container_id = container.get('Id') - client.start(container=container_id) - - # Execute commands to verify versions - exec_cmd = client.exec_create( - container=container_id, - cmd=f"/bin/sh -c '{command}'", - stdout=True, - stderr=True, - ) - cmd_output = client.exec_start(exec_id=exec_cmd['Id'], stream=False) - cmd_output = cmd_output.decode('utf-8', 'replace').strip() - client.kill(container_id) - +def test_command_versions_image_60(command, expected_output): + cmd_output = run_command_in_container('readthedocs/build:6.0', command) assert cmd_output == expected_output diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..f403851 --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,37 @@ +from docker import APIClient + + +def run_command_in_container(container_image, command): + client = APIClient() + + # Create the container + container = client.create_container( + image=container_image, + command=( + '/bin/sh -c "sleep {time}; exit {exit}"'.format( + time=60, + exit=42, + ) + ), + detach=True, + user='docs', + ) + + # Start the container + container_id = container.get('Id') + client.start(container=container_id) + + # Execute commands to verify versions + exec_cmd = client.exec_create( + container=container_id, + cmd=f"/bin/sh -c '{command}'", + stdout=True, + stderr=True, + ) + cmd_output = client.exec_start(exec_id=exec_cmd['Id'], stream=False) + cmd_output = cmd_output.decode('utf-8', 'replace').strip() + + # Kill container + client.kill(container_id) + + return cmd_output From 7374b6bd7fe721ece0c5a879f61a7416bb579db1 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 10:37:41 +0200 Subject: [PATCH 06/19] Test more docker images (5.0, 6.0 and 7.0) --- tests/test_versions.py | 74 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index 5e6e19a..bb9af93 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -4,11 +4,50 @@ from .utils import run_command_in_container +@pytest.mark.image_70 +@pytest.mark.parametrize( + 'command,expected_output', + [ + # python + ('python2 --version', 'Python 2.7.18'), + ('python3.5 --version', 'Python 3.5.10'), + ('python3.6 --version', 'Python 3.6.12'), + ('python3.7 --version', 'Python 3.7.9'), + ('python3.8 --version', 'Python 3.8.6'), + ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), + # pip + ('python2 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 3.5)"), + ('python3.5 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), + ('python3.6 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), + ('python3.7 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), + ('python3.8 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip (python 3.8)"), + # setuptools + ('python2 -c "import setuptools; print(setuptools.__version__)"', "44.0.0"), + ('python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), + ('python3.6 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), + ('python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), + ('python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), + # virtualenv + ('python2 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.7.16/lib/python2.7/site-packages/virtualenv/__init__.pyc'), + ('python3.5 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/virtualenv/__init__.pyc'), + ('python3.6 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/virtualenv/__init__.pyc'), + ('python3.7 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/virtualenv/__init__.pyc'), + ('python3.8 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/virtualenv/__init__.pyc'), + # others + ('node --version', 'v8.10.0'), + ('npm --version', '3.5.2'), + ('conda --version', 'conda 4.6.14'), + ] +) +def test_command_versions_image_70(command, expected_output): + cmd_output = run_command_in_container('readthedocs/build:7.0', command) + assert cmd_output == expected_output + + @pytest.mark.image_60 @pytest.mark.parametrize( 'command,expected_output', [ - # TODO: add other Docker images as well # python ('python2 --version', 'Python 2.7.18'), ('python3.5 --version', 'Python 3.5.10'), @@ -17,6 +56,7 @@ ('python3.8 --version', 'Python 3.8.6'), ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip + ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 3.5)"), ('python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), ('python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), ('python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), @@ -42,3 +82,35 @@ def test_command_versions_image_60(command, expected_output): cmd_output = run_command_in_container('readthedocs/build:6.0', command) assert cmd_output == expected_output + + +@pytest.mark.image_50 +@pytest.mark.parametrize( + 'command,expected_output', + [ + # python + ('python2 --version', 'Python 2.7.18'), + ('python3.6 --version', 'Python 3.6.12'), + ('python3.7 --version', 'Python 3.7.9'), + ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), + # pip + ('python2 -m pip --version', "pip 19.1.1 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pip (python 2.7)"), + ('python3.6 -m pip --version', "pip 19.1.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), + ('python3.7 -m pip --version', "pip 19.1.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), + # setuptools + ('python2 -c "import setuptools; print(setuptools.__version__)"', "41.0.1"), + ('python3.6 -c "import setuptools; print(setuptools.__version__)"', "41.0.1"), + ('python3.7 -c "import setuptools; print(setuptools.__version__)"', "41.0.1"), + # virtualenv + ('python2 -m virtualenv --version', '16.6.0'), + ('python3.6 -m virtualenv --version', '16.6.0'), + ('python3.7 -m virtualenv --version', '16.6.0'), + # others + ('node --version', 'v8.10.0'), + ('npm --version', '3.5.2'), + ('conda --version', 'conda 4.6.14'), + ] +) +def test_command_versions_image_50(command, expected_output): + cmd_output = run_command_in_container('readthedocs/build:5.0', command) + assert cmd_output == expected_output From 62fa6021b7ba20ce6c568f688e758a7dd6fc5cd8 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 11:11:06 +0200 Subject: [PATCH 07/19] Add test for cargo/rust version on 7.0 --- tests/test_versions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_versions.py b/tests/test_versions.py index bb9af93..acc93b4 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -37,6 +37,7 @@ ('node --version', 'v8.10.0'), ('npm --version', '3.5.2'), ('conda --version', 'conda 4.6.14'), + ('cargo --version', 'cargo 1.46.0 (149022b1d 2020-07-17)'), ] ) def test_command_versions_image_70(command, expected_output): From cb30e11d3b25b9a0097b141559626ec62129d720 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 11:22:15 +0200 Subject: [PATCH 08/19] Add tests for readthedocs/build:master tag --- tests/test_versions.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/test_versions.py b/tests/test_versions.py index acc93b4..d37e9ae 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -4,6 +4,47 @@ from .utils import run_command_in_container +@pytest.mark.image_master +@pytest.mark.parametrize( + 'command,expected_output', + [ + # python + ('python2 --version', 'Python 2.7.18'), + ('python3.5 --version', 'Python 3.5.10'), + ('python3.6 --version', 'Python 3.6.12'), + ('python3.7 --version', 'Python 3.7.9'), + ('python3.8 --version', 'Python 3.8.6'), + ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), + # pip + ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 3.5)"), + ('python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), + ('python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), + ('python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), + ('python3.8 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip (python 3.8)"), + # setuptools + ('python2 -c "import setuptools; print(setuptools.__version__)"', "44.0.0"), + ('python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python3.6 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + ('python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), + # virtualenv + ('python2 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.7.16/lib/python2.7/site-packages/virtualenv/__init__.pyc'), + ('python3.5 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/virtualenv/__init__.pyc'), + ('python3.6 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/virtualenv/__init__.pyc'), + ('python3.7 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/virtualenv/__init__.pyc'), + ('python3.8 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/virtualenv/__init__.pyc'), + # others + ('node --version', 'v10.19.0'), + ('npm --version', '6.14.4'), + ('conda --version', 'conda 4.6.14'), + ('cargo --version', 'cargo 1.46.0 (149022b1d 2020-07-17)'), + ] +) +def test_command_versions_image_master(command, expected_output): + cmd_output = run_command_in_container('readthedocs/build:7.0', command) + assert cmd_output == expected_output + + @pytest.mark.image_70 @pytest.mark.parametrize( 'command,expected_output', From 63be4256764c7a6f83414e44cf6aec5bcfaec0e7 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 11:24:08 +0200 Subject: [PATCH 09/19] Run tests in all the branches we care --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0fd9371..6dc8fd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,12 @@ install: - pipenv install script: - docker build -t readthedocs/build:master . - - pipenv run pytest -m master + - pipenv run pytest -m image_master branches: only: - master + - releases/5.x - releases/6.x + - releases/7.x + - releases/8.x From b803b81c0c1fbafd213bd576c3178479f7f49e36 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 11:47:41 +0200 Subject: [PATCH 10/19] Add check for git --version --- tests/test_versions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_versions.py b/tests/test_versions.py index d37e9ae..8c68863 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -38,6 +38,7 @@ ('npm --version', '6.14.4'), ('conda --version', 'conda 4.6.14'), ('cargo --version', 'cargo 1.46.0 (149022b1d 2020-07-17)'), + ('git --version', 'git version 2.25.1'), ] ) def test_command_versions_image_master(command, expected_output): @@ -79,6 +80,7 @@ def test_command_versions_image_master(command, expected_output): ('npm --version', '3.5.2'), ('conda --version', 'conda 4.6.14'), ('cargo --version', 'cargo 1.46.0 (149022b1d 2020-07-17)'), + ('git --version', 'git version 2.17.1'), ] ) def test_command_versions_image_70(command, expected_output): @@ -119,6 +121,7 @@ def test_command_versions_image_70(command, expected_output): ('node --version', 'v8.10.0'), ('npm --version', '3.5.2'), ('conda --version', 'conda 4.6.14'), + ('git --version', 'git version 2.17.1'), ] ) def test_command_versions_image_60(command, expected_output): @@ -151,6 +154,7 @@ def test_command_versions_image_60(command, expected_output): ('node --version', 'v8.10.0'), ('npm --version', '3.5.2'), ('conda --version', 'conda 4.6.14'), + ('git --version', 'git version 2.17.1'), ] ) def test_command_versions_image_50(command, expected_output): From b983e371067c56a5ad56088405e18f59aa173e57 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 15:03:20 +0200 Subject: [PATCH 11/19] Use `readthedocs/build:master` as image name --- tests/test_versions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index 8c68863..ae01e37 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -42,7 +42,7 @@ ] ) def test_command_versions_image_master(command, expected_output): - cmd_output = run_command_in_container('readthedocs/build:7.0', command) + cmd_output = run_command_in_container('readthedocs/build:master', command) assert cmd_output == expected_output From 6f9c5f5a0f312b0417a13ad5621e233baaa7a992 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 15:24:59 +0200 Subject: [PATCH 12/19] Use --cache-from for `docker build` It will download the image from Docker Hub and use its layers as cache. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6dc8fd4..330b20d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_install: install: - pipenv install script: - - docker build -t readthedocs/build:master . + - docker build --cache-from readthedocs/build:master -t readthedocs/build:master . - pipenv run pytest -m image_master branches: From 3d48a20f37fbd48e41ad32cdee8c5c2d9f122920 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 15:32:19 +0200 Subject: [PATCH 13/19] Pull the image before to use is as cache --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 330b20d..4f19bd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: - PIPENV_IGNORE_VIRTUALENVS=1 before_install: - pip install pipenv + - docker pull readthedocs/build:master || true install: - pipenv install script: From 5debade1e8107ceaf538db4f7f5332d0fda4b542 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 15:41:59 +0200 Subject: [PATCH 14/19] Fix virtualenv versions on master --- tests/test_versions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index ae01e37..4fa0d21 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -28,11 +28,11 @@ ('python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), ('python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.1.0"), # virtualenv - ('python2 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.7.16/lib/python2.7/site-packages/virtualenv/__init__.pyc'), - ('python3.5 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/virtualenv/__init__.pyc'), - ('python3.6 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/virtualenv/__init__.pyc'), - ('python3.7 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/virtualenv/__init__.pyc'), - ('python3.8 -m virtualenv --version', 'virtualenv 16.7.9 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/virtualenv/__init__.pyc'), + ('python2 -m virtualenv --version', '16.7.9'), + ('python3.5 -m virtualenv --version', '16.7.9'), + ('python3.6 -m virtualenv --version', '16.7.9'), + ('python3.7 -m virtualenv --version', '16.7.9'), + ('python3.8 -m virtualenv --version', '16.7.9'), # others ('node --version', 'v10.19.0'), ('npm --version', '6.14.4'), From 6fbed193e694f647c3f66485527a27e154fb5384 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 15:42:10 +0200 Subject: [PATCH 15/19] Fix pip version for python2 on master --- tests/test_versions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index 4fa0d21..3127d09 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -16,7 +16,7 @@ ('python3.8 --version', 'Python 3.8.6'), ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip - ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 3.5)"), + ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 2.7)"), ('python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), ('python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), ('python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), From 3dc59579905d3678de6838f6ed43afff30b1a76d Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 16:16:42 +0200 Subject: [PATCH 16/19] Py2 pip version, again :( --- tests/test_versions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index 3127d09..364c45a 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -16,7 +16,7 @@ ('python3.8 --version', 'Python 3.8.6'), ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip - ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 2.7)"), + ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pip (python 2.7)"), ('python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), ('python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), ('python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), From e01570004958ef606b2d5c357e91a276669f9d13 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 15 Oct 2020 19:09:27 +0200 Subject: [PATCH 17/19] More versions fixes --- tests/test_versions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_versions.py b/tests/test_versions.py index 364c45a..e9643fd 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -58,7 +58,7 @@ def test_command_versions_image_master(command, expected_output): ('python3.8 --version', 'Python 3.8.6'), ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip - ('python2 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 3.5)"), + ('python2 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pip (python 2.7)"), ('python3.5 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), ('python3.6 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), ('python3.7 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), @@ -70,7 +70,7 @@ def test_command_versions_image_master(command, expected_output): ('python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), ('python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), # virtualenv - ('python2 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.7.16/lib/python2.7/site-packages/virtualenv/__init__.pyc'), + ('python2 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/virtualenv/__init__.pyc'), ('python3.5 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/virtualenv/__init__.pyc'), ('python3.6 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/virtualenv/__init__.pyc'), ('python3.7 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/virtualenv/__init__.pyc'), @@ -100,7 +100,7 @@ def test_command_versions_image_70(command, expected_output): ('python3.8 --version', 'Python 3.8.6'), ('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'), # pip - ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python3.5/site-packages/pip (python 3.5)"), + ('python2 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pip (python 2.7)"), ('python3.5 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/pip (python 3.5)"), ('python3.6 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/pip (python 3.6)"), ('python3.7 -m pip --version', "pip 20.0.1 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"), From fd3d0aad4bba4e40785af1008e7d75bff4dffc7a Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 19 Oct 2020 14:04:41 +0200 Subject: [PATCH 18/19] Run tests for readthedocs/build:5.0 image --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4f19bd0..06eee63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,12 @@ env: - PIPENV_IGNORE_VIRTUALENVS=1 before_install: - pip install pipenv - - docker pull readthedocs/build:master || true + - docker pull readthedocs/build:5.0 || true install: - pipenv install script: - - docker build --cache-from readthedocs/build:master -t readthedocs/build:master . - - pipenv run pytest -m image_master + - docker build --cache-from readthedocs/build:5.0 -t readthedocs/build:5.0 . + - pipenv run pytest -m image_50 branches: only: From 38462394289a88cb9c7c31a434243ba0ce0b04b3 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 19 Oct 2020 14:33:00 +0200 Subject: [PATCH 19/19] Do not use Docker image cache We can't use `--cache-from` because the `apt-get update` command is used from cache and that could make the package versions/URLs to be outdated and fail. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06eee63..2d11e16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,10 @@ env: - PIPENV_IGNORE_VIRTUALENVS=1 before_install: - pip install pipenv - - docker pull readthedocs/build:5.0 || true install: - pipenv install script: - - docker build --cache-from readthedocs/build:5.0 -t readthedocs/build:5.0 . + - docker build -t readthedocs/build:5.0 . - pipenv run pytest -m image_50 branches: