1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 15:04:43 +00:00

more python versions support

This commit is contained in:
deadc0de6
2025-12-30 17:17:19 +01:00
committed by deadc0de
parent 55c5869c30
commit 36e2e8a32d
6 changed files with 79 additions and 26 deletions

View File

@@ -9,7 +9,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python 3.10 - name: Set up Python 3.10
uses: actions/setup-python@v4 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.10'
- name: Install Tools - name: Install Tools

View File

@@ -2,10 +2,10 @@ name: tests
on: [push, pull_request, workflow_dispatch] on: [push, pull_request, workflow_dispatch]
jobs: jobs:
test: test:
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}

4
.gitignore vendored
View File

@@ -7,6 +7,10 @@ build/
tags tags
env env
venv venv
.venv
.venv*
.env
.env*
.pytest_cache .pytest_cache
.mypy_cache .mypy_cache

4
pyproject.toml vendored
View File

@@ -11,11 +11,15 @@ license = 'GPL-3.0'
requires-python = ">=3" requires-python = ">=3"
classifiers = [ classifiers = [
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
] ]
keywords = ['dotfiles', 'jinja2'] keywords = ['dotfiles', 'jinja2']
dependencies = [ dependencies = [

View File

@@ -117,7 +117,12 @@ done
# check other python scripts # check other python scripts
echo "-----------------------------------------" echo "-----------------------------------------"
echo "checking other python scripts with pylint" echo "checking other python scripts with pylint"
find . -name "*.py" -not -path "./dotdrop/*" -not -regex "\./\.?v?env/.*" | while read -r script; do find . \
-path "./dotdrop" -prune -o \
-path "./.venv" -prune -o \
-path "./venv" -prune -o \
-path "./build" -prune -o \
-name "*.py" -print | while read -r script; do
echo "checking ${script}" echo "checking ${script}"
pylint -sn \ pylint -sn \
--disable=W0012 \ --disable=W0012 \

84
tests.sh vendored
View File

@@ -5,6 +5,38 @@
# stop on first error # stop on first error
set -eu -o errtrace -o pipefail 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) cur=$(cd "$(dirname "${0}")" && pwd)
in_cicd="${GITHUB_WORKFLOW:-}" in_cicd="${GITHUB_WORKFLOW:-}"
@@ -24,32 +56,40 @@ if [ "${dotdrop_version}" != "${man_version}" ]; then
fi fi
echo "current dotdrop version ${dotdrop_version}" 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 if [ -n "${in_cicd}" ]; then
# in CI/CD test
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 else
echo "tests-ng..." if [ -n "${MULTI_PYTHON}" ]; then
"${cur}"/scripts/check-tests-ng.sh 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 fi
# merge coverage # merge coverage
coverage combine coverages/* coverage combine coverages/*
coverage xml coverage xml