Skip to content

Commit

Permalink
Merge pull request #44 from reecetech/drop-old-py-versions
Browse files Browse the repository at this point in the history
Drop support for Python 3.7 and 3.8; Switch to supported `docker compose` for testing
  • Loading branch information
ps-jay authored Nov 21, 2024
2 parents da6eb20 + 8a8e75a commit fd82919
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 94 deletions.
86 changes: 1 addition & 85 deletions Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
# Best to compile and test as non-root
ARG nonroot_uid=3973

##------------------------------------------------------------------------------
FROM python:3.7 AS py37

RUN echo "${PYTHON_VERSION}" > /tmp/py37-latest

##------------------------------------------------------------------------------
FROM python:3.8 AS py38

RUN echo "${PYTHON_VERSION}" > /tmp/py38-latest

##------------------------------------------------------------------------------
FROM python:3.9 AS py39

Expand Down Expand Up @@ -62,72 +52,6 @@ RUN mkdir /usr/local/openssl11 \

RUN mkdir /src

##------------------------------------------------------------------------------
FROM builder-base AS builder-py37
ARG py_ver=37
ARG nonroot_uid
COPY --from=py37 /tmp/py${py_ver}-latest /tmp/

RUN mkdir /opt/py${py_ver} && chown -R ${nonroot_uid} /opt/py${py_ver} /src
USER ${nonroot_uid}
WORKDIR /tmp

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& curl --silent --show-error --fail --location \
"https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \
| tar -xz

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& cd "/tmp/Python-${PYTHON_VERSION}" \
&& ./configure --prefix=/opt/py${py_ver} --enable-optimizations \
&& make -j 4 altinstall

USER root
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
RUN pip3 install tox
USER ${nonroot_uid}

ENV HOME=/src
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
WORKDIR /src

ADD django_informixdb/ /src/django_informixdb/
ADD README.rst setup.* tox.ini /src/
RUN tox -e "$(tox --listenvs | grep py${py_ver} | tr '\n' ',')" --notest # prep venvs

##------------------------------------------------------------------------------
FROM builder-base AS builder-py38
ARG py_ver=38
ARG nonroot_uid
COPY --from=py38 /tmp/py${py_ver}-latest /tmp/

RUN mkdir /opt/py${py_ver} && chown -R ${nonroot_uid} /opt/py${py_ver} /src
USER ${nonroot_uid}
WORKDIR /tmp

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& curl --silent --show-error --fail --location \
"https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \
| tar -xz

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& cd "/tmp/Python-${PYTHON_VERSION}" \
&& ./configure --prefix=/opt/py${py_ver} --enable-optimizations \
&& make -j 4 altinstall

USER root
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
RUN pip3 install tox
USER ${nonroot_uid}

ENV HOME=/src
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
WORKDIR /src

ADD django_informixdb/ /src/django_informixdb/
ADD README.rst setup.* tox.ini /src/
RUN tox -e "$(tox --listenvs | grep py${py_ver} | tr '\n' ',')" --notest # prep venvs

##------------------------------------------------------------------------------
FROM builder-base AS builder-py39
ARG py_ver=39
Expand Down Expand Up @@ -206,14 +130,6 @@ COPY --chown=${nonroot_uid} \
FROM csdk AS multipy
ARG nonroot_uid

COPY --from=builder-py37 /opt/py37/ /opt/py37/
COPY --from=builder-py37 /src/.tox/ /src/.tox/
COPY --from=builder-py37 /src/.cache/ /src/.cache/

COPY --from=builder-py38 /opt/py38/ /opt/py38/
COPY --from=builder-py38 /src/.tox/ /src/.tox/
COPY --from=builder-py38 /src/.cache/ /src/.cache/

COPY --from=builder-py39 /opt/py39/ /opt/py39/
COPY --from=builder-py39 /src/.tox/ /src/.tox/
COPY --from=builder-py39 /src/.cache/ /src/.cache/
Expand All @@ -230,7 +146,7 @@ ADD --chown=${nonroot_uid} django_informixdb/ /src/django_informixdb/
ADD --chown=${nonroot_uid} test/ /src/test/
RUN chown ${nonroot_uid} /src

ENV PATH=/opt/py310/bin:/opt/py39/bin:/opt/py38/bin:/opt/py37/bin:"${PATH}"
ENV PATH=/opt/py310/bin:/opt/py39/bin:"${PATH}"
RUN pip3 --no-cache-dir install tox

USER ${nonroot_uid}
Expand Down
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ Requirements: Docker 19.03.2 or newer and Docker Compose 1.24.1 or newer.
Release History
---------------

Version 1.12.1

- End support for Python 3.7
- End support for Python 3.8
- Rework to newer Docker Compose for testing

Version 1.11.4

- Update pyproject.toml / setup.cfg and update docker tests to use Rocky9 instead of Centos7
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ classifiers=[
'Topic :: Scientific/Engineering',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
]
Expand Down Expand Up @@ -53,4 +51,4 @@ version = {attr = "django_informixdb.VERSION"}
readme = {file = "README.rst"}

[tool.distutils.bdist_wheel]
universal = true
universal = true
10 changes: 5 additions & 5 deletions test-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ export uniq_test_id="${uniq_test_id:-djifx}"

cleanup() {
echo "--- cleaning up: previous code ${?}"
docker-compose -p "${uniq_test_id}" down --volumes --remove-orphans
docker compose -p "${uniq_test_id}" down --volumes --remove-orphans
}
trap cleanup EXIT

echo "--- building docker images"
docker-compose -p "${uniq_test_id}" build
docker compose -p "${uniq_test_id}" build

echo "--- starting dependencies"
docker-compose -p "${uniq_test_id}" up -d db
docker compose -p "${uniq_test_id}" up -d db

echo "--- waiting for dependencies"
docker-compose -p "${uniq_test_id}" run test-runner /usr/local/bin/wait-for-deps.sh
docker compose -p "${uniq_test_id}" run test-runner /usr/local/bin/wait-for-deps.sh

echo "--- running tests"
docker-compose -p "${uniq_test_id}" run test-runner tox
docker compose -p "${uniq_test_id}" run test-runner tox
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37-dj3,py38-dj3,py39-dj3,py310-dj3,py38-dj4,py39-dj4,py310-dj4
envlist = py39-dj3,py310-dj3,py39-dj4,py310-dj4

[testenv]
deps =
Expand Down

0 comments on commit fd82919

Please sign in to comment.