Skip to content

Commit

Permalink
Comprehensive docker testing
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
phihag committed Oct 18, 2019
1 parent 10a3a5e commit f92edc4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion Dockerfile.python2.6 → test-python2.6.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM lovato/python-2.6.6
# Dockerfile to run tests under python2.6

# docker build -t ipaddress-python2.6 . -f Dockerfile.python2.6
# docker build -t ipaddress-python2.6 . -f test-python2.6.Dockerfile

ADD . .
RUN python test_ipaddress.py
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.python2.7 → test-python2.7.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:2.7-alpine
# Dockerfile to run tests under python2.7

# docker build -t ipaddress-python2.7 . -f Dockerfile.python2.7
# docker build -t ipaddress-python2.7 . -f test-python2.7.Dockerfile
RUN apk add make
RUN pip install flake8

Expand Down
8 changes: 8 additions & 0 deletions test-python3.2.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions test-python3.3.Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f92edc4

Please sign in to comment.