Skip to content

Commit

Permalink
ci: Configure docker/travis from travis.yml
Browse files Browse the repository at this point in the history
This patch let's us configure the upstream mbedTLS version and the
Python version used for testing explicitly from the travis.yml file.
  • Loading branch information
Synss committed Oct 16, 2020
1 parent 449fd44 commit bed4222
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 31 deletions.
52 changes: 31 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,31 @@ before_install:
- docker pull $IMAGE:builder
- >
docker build
--target builder
--cache-from $IMAGE:builder
--tag $IMAGE:builder
--build-arg ARCH=$ARCH
.
--target builder
--cache-from $IMAGE:builder
--tag $IMAGE:builder
--build-arg ARCH=$ARCH
--build-arg MBEDTLS_VERSION=2.16.8
.
- docker pull $IMAGE:latest
- >
docker build
--cache-from $IMAGE:builder
--cache-from $IMAGE:latest
--tag $IMAGE:$TRAVIS_BUILD_NUMBER
--tag $IMAGE:latest
--build-arg ARCH=$ARCH
.
--cache-from $IMAGE:builder
--cache-from $IMAGE:latest
--tag $IMAGE:$TRAVIS_BUILD_NUMBER
--tag $IMAGE:latest
--build-arg ARCH=$ARCH
.
- >
docker run
--rm
--interactive
--tty
--detach
--name $CONTAINER
--network=host
$IMAGE:latest
$PRE_CMD /bin/sh
--rm
--interactive
--tty
--detach
--name $CONTAINER
--network=host
$IMAGE:latest
$PRE_CMD /bin/sh
install:
- pip install -r requirements/travis.txt
Expand All @@ -55,13 +56,22 @@ script:
- devpi upload wheelhouse/* sdist/*
- devpi list python-mbedtls
- >
docker exec
for tag in
"cp27-cp27m"
"cp27-cp27mu"
"cp35-cp35m"
"cp36-cp36m"
"cp37-cp37m"
"cp38-cp38"
"cp39-cp39";
do docker exec
--interactive
--tty
--env PIP_INDEX_URL
$CONTAINER
$PRE_CMD /bin/sh -c
scripts/run-tests.sh
scripts/run-tests.sh $tag;
done
after_script:
- scripts/stop-devpi.sh
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG ARCH=x86_64
ARG MBEDTLS_VERSION

FROM quay.io/pypa/manylinux2010_${ARCH}:latest as base

Expand All @@ -8,7 +9,7 @@ RUN yum -y update \
&& yum -yq install cmake \
&& yum clean all
COPY ./scripts/ ./scripts/
RUN ./scripts/download-mbedtls.sh 2.16.8 /usr/local/src \
RUN ./scripts/download-mbedtls.sh $MBEDTLS_VERSION /usr/local/src \
&& ./scripts/install-mbedtls.sh /usr/local/src /usr/local \
&& cp /usr/local/src/LICENSE LICENSE.mbedtls \
&& rm -r /usr/local/src
Expand Down
25 changes: 16 additions & 9 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

set -ex

echo "Index: $PIP_INDEX_URL"
if [ $# -ne 1 ]; then
cat <<- EOF
usage:
$0 PYTHON_TAG
for pydir in /opt/python/*; do
$pydir/bin/python -m pip install -r requirements/tests.txt
$pydir/bin/python -m pip install \
--only-binary=:all: \
python-mbedtls
$pydir/bin/python -B -m pytest
done
EOF
exit 1
fi
echo "Index: $PIP_INDEX_URL"
/opt/python/*36*/bin/python -B -m doctest README.rst
pydir="/opt/python/$1/"
$pydir/bin/python -m pip install -r requirements/tests.txt
$pydir/bin/python -m pip install \
--only-binary=:all: \
python-mbedtls
$pydir/bin/python -B -m pytest

0 comments on commit bed4222

Please sign in to comment.