1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 15:39: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:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Tools

View File

@@ -2,10 +2,10 @@ name: tests
on: [push, pull_request, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
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:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

4
.gitignore vendored
View File

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

4
pyproject.toml vendored
View File

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

View File

@@ -117,7 +117,12 @@ done
# check other python scripts
echo "-----------------------------------------"
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}"
pylint -sn \
--disable=W0012 \

76
tests.sh vendored
View File

@@ -5,25 +5,11 @@
# stop on first error
set -eu -o errtrace -o pipefail
cur=$(cd "$(dirname "${0}")" && pwd)
in_cicd="${GITHUB_WORKFLOW:-}"
if [ -n "${in_cicd}" ]; then
# patch TERM var in ci/cd
if [ -z "${TERM}" ]; then
export TERM="linux"
fi
fi
# make sure both version.py and manpage dotdrop.1 are in sync
dotdrop_version=$(grep version dotdrop/version.py | sed 's/^.*= .\(.*\).$/\1/g')
man_version=$(grep '^\.TH' manpage/dotdrop.1 | sed 's/^.*"dotdrop-\(.*\)\" "Save your.*$/\1/g')
if [ "${dotdrop_version}" != "${man_version}" ]; then
echo "ERROR version.py (${dotdrop_version}) and manpage (${man_version}) differ!"
exit 1
fi
echo "current dotdrop version ${dotdrop_version}"
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
@@ -49,6 +35,60 @@ else
echo "tests-ng..."
"${cur}"/scripts/check-tests-ng.sh
fi
}
cur=$(cd "$(dirname "${0}")" && pwd)
in_cicd="${GITHUB_WORKFLOW:-}"
if [ -n "${in_cicd}" ]; then
# patch TERM var in ci/cd
if [ -z "${TERM}" ]; then
export TERM="linux"
fi
fi
# make sure both version.py and manpage dotdrop.1 are in sync
dotdrop_version=$(grep version dotdrop/version.py | sed 's/^.*= .\(.*\).$/\1/g')
man_version=$(grep '^\.TH' manpage/dotdrop.1 | sed 's/^.*"dotdrop-\(.*\)\" "Save your.*$/\1/g')
if [ "${dotdrop_version}" != "${man_version}" ]; then
echo "ERROR version.py (${dotdrop_version}) and manpage (${man_version}) differ!"
exit 1
fi
echo "current dotdrop version ${dotdrop_version}"
if [ -n "${in_cicd}" ]; then
test
else
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/*