diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..625c819 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,31 @@ +version: 2 + +jobs: + tests: + docker: + - image: circleci/python:3.6 + environment: + PIPENV_VENV_IN_PROJECT=1 + PIPENV_IGNORE_VIRTUALENVS=1 + steps: + - checkout + - setup_remote_docker: + version: 20.10.6 + docker_layer_caching: true + - run: + name: Setup + command: | + pip install pipenv + pipenv install + - run: + name: Build Docker image + command: docker build -t readthedocs/build:7.0 . + - run: + name: Run tests + command: pipenv run pytest -m image_70 + +workflows: + version: 2 + tests: + jobs: + - tests diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1deca5b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: python -python: - - "3.6" -env: - global: - - PIPENV_VENV_IN_PROJECT=1 - - PIPENV_IGNORE_VIRTUALENVS=1 -before_install: - - pip install pipenv -install: - - pipenv install -script: - - docker build -t readthedocs/build:7.0 . - - pipenv run pytest -m image_70 - - -branches: - only: - - master - - releases/5.x - - releases/6.x - - releases/7.x - - releases/8.x diff --git a/Dockerfile b/Dockerfile index ad7d27f..4a6509c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,17 +14,21 @@ ENV PYTHON_VERSION_36 3.6.12 ENV PYTHON_VERSION_37 3.7.9 ENV PYTHON_VERSION_38 3.8.6 ENV PYTHON_VERSION_39 3.9.1 +ENV PYTHON_VERSION_310 3.10.0b4 ENV PYPY_VERSION_35 pypy3.5-7.0.0 -# Note: 4.7.12.1 drastically increases memory usage -ENV CONDA_VERSION 4.6.14 +# Latest miniconda version is Miniconda3-py39_4.10.1, but it's not available for x86_64 +ENV CONDA_PYTHON_VERSION py39 +ENV CONDA_VERSION 4.9.2 LABEL python.version_27=$PYTHON_VERSION_27 LABEL python.version_35=$PYTHON_VERSION_35 LABEL python.version_36=$PYTHON_VERSION_36 LABEL python.version_37=$PYTHON_VERSION_37 LABEL python.version_38=$PYTHON_VERSION_38 LABEL python.version_39=$PYTHON_VERSION_39 +LABEL python.version_310=$PYTHON_VERSION_310 LABEL pypy.version_35=$PYPY_VERSION_35 LABEL conda.version=$CONDA_VERSION +LABEL conda.python_version=$CONDA_PYTHON_VERSION # System dependencies RUN apt-get -y update @@ -75,6 +79,7 @@ RUN apt-get install -y \ libncurses5-dev \ libncursesw5-dev \ libssl-dev \ + libxmlsec1-dev \ llvm \ make \ python-openssl \ @@ -141,14 +146,6 @@ RUN apt-get -y install \ auxlib \ virtualenv==$RTD_VIRTUALENV_VERSION -# sphinx-js dependencies: jsdoc and typedoc (TypeScript support) -RUN apt-get -y install \ - nodejs \ - npm \ - && npm install --global \ - jsdoc \ - typedoc - # UID and GID from readthedocs/user RUN groupadd --gid 205 docs RUN useradd -m --uid 1005 --gid 205 docs @@ -157,10 +154,10 @@ USER docs WORKDIR /home/docs # Install Conda -RUN curl -L -O https://repo.continuum.io/miniconda/Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh -RUN bash Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/ +RUN curl -L -O https://repo.continuum.io/miniconda/Miniconda3-${CONDA_PYTHON_VERSION}_${CONDA_VERSION}-Linux-x86_64.sh && \ + bash Miniconda3-${CONDA_PYTHON_VERSION}_${CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/ && \ + rm -f Miniconda3-${CONDA_PYTHON_VERSION}_${CONDA_VERSION}-Linux-x86_64.sh ENV PATH $PATH:/home/docs/.conda/bin -RUN rm -f Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh # Install Rust ENV RTD_RUST_VERSION 1.46.0 @@ -177,6 +174,7 @@ ENV PATH /home/docs/.pyenv/shims:$PATH:/home/docs/.pyenv/bin # Install supported Python versions RUN pyenv install $PYTHON_VERSION_27 && \ + pyenv install $PYTHON_VERSION_310 && \ pyenv install $PYTHON_VERSION_39 && \ pyenv install $PYTHON_VERSION_38 && \ pyenv install $PYTHON_VERSION_37 && \ @@ -185,6 +183,7 @@ RUN pyenv install $PYTHON_VERSION_27 && \ pyenv install $PYPY_VERSION_35 && \ pyenv global \ $PYTHON_VERSION_27 \ + $PYTHON_VERSION_310 \ $PYTHON_VERSION_39 \ $PYTHON_VERSION_38 \ $PYTHON_VERSION_37 \ @@ -202,6 +201,13 @@ RUN pyenv local $PYTHON_VERSION_27 && \ ENV RTD_PIP_VERSION 20.0.2 ENV RTD_SETUPTOOLS_VERSION 45.2.0 + +# NOTE: numpy is not installed by default because it's not built for Python 3.10 yet +RUN pyenv local $PYTHON_VERSION_310 && \ + pyenv exec pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \ + pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \ + pyenv exec pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION + RUN pyenv local $PYTHON_VERSION_39 && \ pyenv exec pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \ pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \ @@ -238,6 +244,22 @@ RUN pyenv local $PYPY_VERSION_35 && \ pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \ pyenv exec pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION +# NOTE: this is moved to the bottom because apt-get finds some incompatibilities +# between packages and uninstall them: +# The following packages will be REMOVED: +# libmysqlclient-dev libssl-dev libxmlsec1-dev +# As libssl-dev and libxmlsec1-dev are required to build Python with pyenv, +# we first build Python versions and then install these packages +# sphinx-js dependencies: jsdoc and typedoc (TypeScript support) +USER root +RUN apt-get -y install \ + nodejs \ + npm \ + && npm install --global \ + jsdoc@3.6.6 \ + typedoc@0.20.20 + +USER docs WORKDIR / CMD ["/bin/bash"] diff --git a/tests/test_dependencies.py b/tests/test_dependencies.py index ee5f5c2..10b1486 100644 --- a/tests/test_dependencies.py +++ b/tests/test_dependencies.py @@ -14,15 +14,17 @@ def test_miniconda(): base_url = 'https://repo.continuum.io/miniconda' dockerfile = get_dockerfile() conda_version = dockerfile.envs.get('CONDA_VERSION') + conda_python_version = dockerfile.envs.get('CONDA_PYTHON_VERSION') latest = requests.head( - '{base}/Miniconda2-latest-Linux-x86_64.sh'.format( + '{base}/Miniconda3-latest-Linux-x86_64.sh'.format( base=base_url ) ) current = requests.head( - '{base}/Miniconda2-{version}-Linux-x86_64.sh'.format( + '{base}/Miniconda3-{conda_python_version}_{conda_version}-Linux-x86_64.sh'.format( base=base_url, - version=conda_version, + conda_python_version=conda_python_version, + conda_version=conda_version, ) ) assert current.headers['etag'] == latest.headers['etag'] diff --git a/tests/test_versions.py b/tests/test_versions.py index 773971e..7e6aa3e 100644 --- a/tests/test_versions.py +++ b/tests/test_versions.py @@ -1,5 +1,4 @@ import pytest -from docker import APIClient from .utils import run_command_in_container @@ -57,6 +56,7 @@ def test_command_versions_image_master(command, expected_output): ('python3.7 --version', 'Python 3.7.9'), ('python3.8 --version', 'Python 3.8.6'), ('python3.9 --version', 'Python 3.9.1'), + ('python3.10 --version', 'Python 3.10.0b4'), ('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/python2.7/site-packages/pip (python 2.7)"), @@ -65,6 +65,7 @@ def test_command_versions_image_master(command, expected_output): ('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)"), ('python3.9 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pip (python 3.9)"), + ('python3.10 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.10.0b4/lib/python3.10/site-packages/pip (python 3.10)"), # setuptools ('python2 -c "import setuptools; print(setuptools.__version__)"', "44.0.0"), ('python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), @@ -72,6 +73,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"), ('python3.9 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), + ('python3.10 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"), # virtualenv ('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__.py'), @@ -79,12 +81,15 @@ def test_command_versions_image_master(command, expected_output): ('python3.7 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/virtualenv/__init__.py'), ('python3.8 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/virtualenv/__init__.py'), ('python3.9 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.9.1/lib/python3.9/site-packages/virtualenv/__init__.py'), + ('python3.10 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.10.0b4/lib/python3.10/site-packages/virtualenv/__init__.py'), # others ('node --version', 'v8.10.0'), ('npm --version', '3.5.2'), - ('conda --version', 'conda 4.6.14'), + ('conda --version', 'conda 4.9.2'), ('cargo --version', 'cargo 1.46.0 (149022b1d 2020-07-17)'), ('git --version', 'git version 2.17.1'), + ('jsdoc --version', 'JSDoc 3.6.6 (Sun, 20 Sep 2020 02:25:14 GMT)'), + ('cat /usr/local/lib/node_modules/typedoc/package.json | grep -E "version.:"', '"version": "0.20.20"'), ] ) def test_command_versions_image_70(command, expected_output): diff --git a/tests/utils.py b/tests/utils.py index f403851..516e7ef 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,8 +1,9 @@ -from docker import APIClient +import docker def run_command_in_container(container_image, command): - client = APIClient() + # CircleCI exports environment variables that ``.from_env()`` uses + client = docker.from_env().api # Create the container container = client.create_container(