mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 19:44:45 +00:00
more python versions support
This commit is contained in:
84
tests.sh
vendored
84
tests.sh
vendored
@@ -5,6 +5,38 @@
|
||||
# stop on first error
|
||||
set -eu -o errtrace -o pipefail
|
||||
|
||||
MULTI_PYTHON="" # set to test multi python envs
|
||||
PYTHON_VERSIONS=("3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14")
|
||||
|
||||
test()
|
||||
{
|
||||
echo "=> python version:"
|
||||
python3 --version
|
||||
|
||||
# test syntax
|
||||
echo "checking syntax..."
|
||||
"${cur}"/scripts/check-syntax.sh
|
||||
|
||||
# unittest
|
||||
echo "unittest..."
|
||||
"${cur}"/scripts/check-unittests.sh
|
||||
|
||||
# tests-ng
|
||||
if [ -n "${in_cicd}" ]; then
|
||||
# in CI/CD
|
||||
export DOTDROP_WORKERS=1
|
||||
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
|
||||
"${cur}"/scripts/check-tests-ng.sh
|
||||
|
||||
export DOTDROP_WORKERS=4
|
||||
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
|
||||
"${cur}"/scripts/check-tests-ng.sh
|
||||
else
|
||||
echo "tests-ng..."
|
||||
"${cur}"/scripts/check-tests-ng.sh
|
||||
fi
|
||||
}
|
||||
|
||||
cur=$(cd "$(dirname "${0}")" && pwd)
|
||||
in_cicd="${GITHUB_WORKFLOW:-}"
|
||||
|
||||
@@ -24,32 +56,40 @@ if [ "${dotdrop_version}" != "${man_version}" ]; then
|
||||
fi
|
||||
echo "current dotdrop version ${dotdrop_version}"
|
||||
|
||||
echo "=> python version:"
|
||||
python3 --version
|
||||
|
||||
# test syntax
|
||||
echo "checking syntax..."
|
||||
"${cur}"/scripts/check-syntax.sh
|
||||
|
||||
# unittest
|
||||
echo "unittest..."
|
||||
"${cur}"/scripts/check-unittests.sh
|
||||
|
||||
# tests-ng
|
||||
if [ -n "${in_cicd}" ]; then
|
||||
# in CI/CD
|
||||
export DOTDROP_WORKERS=1
|
||||
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
|
||||
"${cur}"/scripts/check-tests-ng.sh
|
||||
|
||||
export DOTDROP_WORKERS=4
|
||||
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
|
||||
"${cur}"/scripts/check-tests-ng.sh
|
||||
test
|
||||
else
|
||||
echo "tests-ng..."
|
||||
"${cur}"/scripts/check-tests-ng.sh
|
||||
if [ -n "${MULTI_PYTHON}" ]; then
|
||||
if ! hash pyenv &>/dev/null; then
|
||||
echo "install pyenv"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval "$(pyenv init -)"
|
||||
for PY in "${PYTHON_VERSIONS[@]}"; do
|
||||
echo "============== python ${PY} =============="
|
||||
pyenv install -s "${PY}"
|
||||
pyenv shell "${PY}"
|
||||
python -m venv ".venv"
|
||||
source ".venv/bin/activate"
|
||||
pip install pip --upgrade
|
||||
pip install -r requirements.txt
|
||||
pip install -r tests-requirements.txt
|
||||
test
|
||||
deactivate
|
||||
done
|
||||
else
|
||||
python3 -m venv ".venv"
|
||||
source ".venv/bin/activate"
|
||||
pip install pip --upgrade
|
||||
pip install -r requirements.txt
|
||||
pip install -r tests-requirements.txt
|
||||
test
|
||||
deactivate
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# merge coverage
|
||||
coverage combine coverages/*
|
||||
coverage xml
|
||||
|
||||
Reference in New Issue
Block a user