mirror of
https://github.com/ipfs-shipyard/py-ipfs-http-client.git
synced 2021-08-30 00:23:11 +03:00
Add scripts to verify compatibility with multiple Python versions, using Docker
This commit is contained in:
committed by
Alexander Schlarb
parent
895df8bb6d
commit
ca46d2abc9
@@ -18,6 +18,8 @@ description-file = "README.md"
|
||||
# `typing.NoReturn` function signature support. (Also, many other `typing` module
|
||||
# items were only introduced post-release in 3.6 and version restrictions on these
|
||||
# versions ensure that those are all available as well.)
|
||||
#
|
||||
# Maintain this concurrently with verify.sh
|
||||
requires-python = ">=3.6.2,!=3.7.0,!=3.7.1"
|
||||
requires = [
|
||||
"multiaddr (>=0.0.7)",
|
||||
|
||||
15
tools/verify/Dockerfile
Normal file
15
tools/verify/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
ARG PYTHON_VERSION
|
||||
|
||||
FROM python:${PYTHON_VERSION}
|
||||
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install tox
|
||||
|
||||
# Mount the source code here, instead of to /usr/src/app.
|
||||
# Otherwise, tox will fail due to folder being read-only.
|
||||
# Mount only the source code; avoid mounting working folders.
|
||||
|
||||
RUN mkdir /source
|
||||
ADD entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
6
tools/verify/entrypoint.sh
Executable file
6
tools/verify/entrypoint.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cp -r /source/* /usr/src/app/
|
||||
|
||||
exec $@
|
||||
|
||||
31
tools/verify/validate.sh
Executable file
31
tools/verify/validate.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
python_version=$1
|
||||
script_path=$(dirname $0)
|
||||
source=$(realpath "$script_path/../..")
|
||||
tag=py-ipfs-http-client-verify:$python_version
|
||||
|
||||
pushd "$script_path"
|
||||
|
||||
echo "Building validator for Python $python_version..."
|
||||
|
||||
docker build --build-arg PYTHON_VERSION="$python_version" -t "$tag" .
|
||||
|
||||
echo "Validating version $python_version"
|
||||
|
||||
docker run \
|
||||
-it \
|
||||
-v "$source/docs":/source/docs:ro \
|
||||
-v "$source/ipfshttpclient":/source/ipfshttpclient:ro \
|
||||
-v "$source/test":/source/test:ro \
|
||||
-v "$source/pyproject.toml":/source/pyproject.toml:ro \
|
||||
-v "$source/README.md":/source/README.md:ro \
|
||||
-v "$source/tox.ini":/source/tox.ini:ro \
|
||||
-w /usr/src/app \
|
||||
"$tag" \
|
||||
tox -e styleck -e typeck
|
||||
|
||||
popd
|
||||
|
||||
19
verify.sh
Executable file
19
verify.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
function validate() {
|
||||
./tools/verify/validate.sh "$1"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Validating minimum point release of each supported minor version..."
|
||||
|
||||
# Maintain this concurrently with [tool.flit.metadata].requires-python in pyproject.toml.
|
||||
validate 3.6.2
|
||||
validate 3.7.2
|
||||
validate 3.8.0
|
||||
else
|
||||
echo "Validating only $1..."
|
||||
validate "$1"
|
||||
fi
|
||||
Reference in New Issue
Block a user