From f92edc4e6163db3ea67b282acf79936f31b73009 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 18 Oct 2019 03:02:43 +0200 Subject: Comprehensive docker testing Docker in conjuction with make allows us to test all 4 supported Python versions in parallel. Add Dockerfiles for 2.6 and 2.7, and rename the existing dockerfiles to end in `.Dockerfile`. --- Dockerfile.python2.6 | 8 -------- Dockerfile.python2.7 | 11 ----------- Makefile | 16 +++++++++++++++- test-python2.6.Dockerfile | 8 ++++++++ test-python2.7.Dockerfile | 11 +++++++++++ test-python3.2.Dockerfile | 8 ++++++++ test-python3.3.Dockerfile | 8 ++++++++ 7 files changed, 50 insertions(+), 20 deletions(-) delete mode 100644 Dockerfile.python2.6 delete mode 100644 Dockerfile.python2.7 create mode 100644 test-python2.6.Dockerfile create mode 100644 test-python2.7.Dockerfile create mode 100644 test-python3.2.Dockerfile create mode 100644 test-python3.3.Dockerfile diff --git a/Dockerfile.python2.6 b/Dockerfile.python2.6 deleted file mode 100644 index 1c11f9f..0000000 --- a/Dockerfile.python2.6 +++ /dev/null @@ -1,8 +0,0 @@ -FROM lovato/python-2.6.6 -# Dockerfile to run tests under python2.6 - -# docker build -t ipaddress-python2.6 . -f Dockerfile.python2.6 - -ADD . . -RUN python test_ipaddress.py -CMD python test_ipaddress.py diff --git a/Dockerfile.python2.7 b/Dockerfile.python2.7 deleted file mode 100644 index 0e92635..0000000 --- a/Dockerfile.python2.7 +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:2.7-alpine -# Dockerfile to run tests under python2.7 - -# docker build -t ipaddress-python2.7 . -f Dockerfile.python2.7 -RUN apk add make -RUN pip install flake8 - -ADD . . -RUN python test_ipaddress.py -RUN make lint -CMD python test_ipaddress.py diff --git a/Makefile b/Makefile index c3f52c4..5ed5f51 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,22 @@ release: git push --tags $(MAKE) pypi +docker-test-all: docker-test-2.6 docker-test-2.7 docker-test-3.2 docker-test-3.3 + +docker-test-2.6: + docker build -t ipaddress-python2.6 . -f test-python2.6.Dockerfile + +docker-test-2.7: + docker build -t ipaddress-python2.7 . -f test-python2.7.Dockerfile + +docker-test-3.2: + docker build -t ipaddress-python3.2 . -f test-python3.2.Dockerfile + +docker-test-3.3: + docker build -t ipaddress-python3.3 . -f test-python3.3.Dockerfile + clean: rm -rf -- build dist ipaddress.egg-info -.PHONY: default test clean pypi lint +.PHONY: default test clean pypi lint docker-test-all docker-test-2.6 docker-test-2.7 docker-test-3.2 docker-test-3.3 diff --git a/test-python2.6.Dockerfile b/test-python2.6.Dockerfile new file mode 100644 index 0000000..5e16329 --- /dev/null +++ b/test-python2.6.Dockerfile @@ -0,0 +1,8 @@ +FROM lovato/python-2.6.6 +# Dockerfile to run tests under python2.6 + +# docker build -t ipaddress-python2.6 . -f test-python2.6.Dockerfile + +ADD . . +RUN python test_ipaddress.py +CMD python test_ipaddress.py diff --git a/test-python2.7.Dockerfile b/test-python2.7.Dockerfile new file mode 100644 index 0000000..9c58f6b --- /dev/null +++ b/test-python2.7.Dockerfile @@ -0,0 +1,11 @@ +FROM python:2.7-alpine +# Dockerfile to run tests under python2.7 + +# docker build -t ipaddress-python2.7 . -f test-python2.7.Dockerfile +RUN apk add make +RUN pip install flake8 + +ADD . . +RUN python test_ipaddress.py +RUN make lint +CMD python test_ipaddress.py diff --git a/test-python3.2.Dockerfile b/test-python3.2.Dockerfile new file mode 100644 index 0000000..56d2b46 --- /dev/null +++ b/test-python3.2.Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.2-slim +# Dockerfile to run tests under python3.2 + +# docker build -t ipaddress-python3.2 . -f test-python3.2.Dockerfile + +ADD . . +RUN python test_ipaddress.py +CMD python test_ipaddress.py diff --git a/test-python3.3.Dockerfile b/test-python3.3.Dockerfile new file mode 100644 index 0000000..87c504e --- /dev/null +++ b/test-python3.3.Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.3-alpine +# Dockerfile to run tests under python3.3 + +# docker build -t ipaddress-python3.3 . -f test-python3.3.Dockerfile + +ADD . . +RUN python test_ipaddress.py +CMD python test_ipaddress.py -- cgit v1.2.3