Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docker/stackify-python-api-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG from_version

FROM python:${from_version}

ARG version

RUN \
apt-get update && \
apt-get install -y flake8 && \
pip install --upgrade pip && \
python --version

RUN mkdir /build
COPY . /build/

RUN cat /build/requirements.txt | xargs -n 1 pip install; exit 0

CMD /bin/bash -c "cd /build && source test-docker-execute.sh"
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,18 @@
long_description=long_description,
long_description_content_type="text/markdown",
keywords=['logging', 'stackify', 'exception'],
classifiers=["Programming Language :: Python"],
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
],
install_requires=[
'protobuf>=3.9.1',
'retrying>=1.2.3',
Expand Down
22 changes: 22 additions & 0 deletions test-docker-execute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

function runFlake8() {
echo '<--------------------------------------------->'
# run flake8 and exit on error
# it will check the code base against coding style (PEP8) and programming errors
echo "Running flake8..."
flake8 || { echo 'You have increased the number of flake8 errors'; exit 1; }
}

function runPyTest() {
echo '<--------------------------------------------->'
echo "Python Version $(python --version)"
echo 'Running pytest...'
py.test
}

runFlake8

runPyTest
29 changes: 29 additions & 0 deletions test-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -e

VERSIONS=('2.7' '3.4' '3.5' '3.6' '3.7' '3.8')
# VERSIONS=('2.7')

for i in "${VERSIONS[@]}"
do

if [[ "$(docker images -q stackify-python-api-test-${i}:latest 2> /dev/null)" != "" ]]; then
echo "Delete stackify-python-api-test-${i}..."
docker rm stackify-python-api-test-${i} &>/dev/null
docker rmi stackify-python-api-test-${i}:latest &>/dev/null
fi

echo "Building stackify-python-api-test-${i}..."
docker build --no-cache --build-arg from_version=${i} --build-arg version=${i} --file docker/stackify-python-api-test . -t stackify-python-api-test-${i}:latest

echo "Running stackify-python-api-test-${i}..."
docker run --network="host" --name "stackify-python-api-test-${i}" stackify-python-api-test-${i}:latest

echo "Delete stackify-python-api-test-${i}..."
docker rm stackify-python-api-test-${i} &>/dev/null
docker rmi stackify-python-api-test-${i}:latest &>/dev/null

done

echo "Done"