Skip to content

Commit 36e2e8a

Browse files
committed
more python versions support
1 parent 55c5869 commit 36e2e8a

6 files changed

Lines changed: 79 additions & 26 deletions

File tree

.github/workflows/pypi-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
- name: Set up Python 3.10
12-
uses: actions/setup-python@v4
12+
uses: actions/setup-python@v5
1313
with:
1414
python-version: '3.10'
1515
- name: Install Tools

.github/workflows/testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: tests
22
on: [push, pull_request, workflow_dispatch]
33
jobs:
44
test:
5-
runs-on: ubuntu-22.04
5+
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
8+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
99
steps:
1010
- uses: actions/checkout@v4
1111
- name: Set up Python ${{ matrix.python-version }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ build/
77
tags
88
env
99
venv
10+
.venv
11+
.venv*
12+
.env
13+
.env*
1014
.pytest_cache
1115
.mypy_cache
1216

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ license = 'GPL-3.0'
1111
requires-python = ">=3"
1212
classifiers = [
1313
'Development Status :: 5 - Production/Stable',
14+
'Programming Language :: Python :: 3.6',
1415
'Programming Language :: Python :: 3.7',
1516
'Programming Language :: Python :: 3.8',
1617
'Programming Language :: Python :: 3.9',
1718
'Programming Language :: Python :: 3.10',
1819
'Programming Language :: Python :: 3.11',
20+
'Programming Language :: Python :: 3.12',
21+
'Programming Language :: Python :: 3.13',
22+
'Programming Language :: Python :: 3.14',
1923
]
2024
keywords = ['dotfiles', 'jinja2']
2125
dependencies = [

scripts/check-syntax.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ done
117117
# check other python scripts
118118
echo "-----------------------------------------"
119119
echo "checking other python scripts with pylint"
120-
find . -name "*.py" -not -path "./dotdrop/*" -not -regex "\./\.?v?env/.*" | while read -r script; do
120+
find . \
121+
-path "./dotdrop" -prune -o \
122+
-path "./.venv" -prune -o \
123+
-path "./venv" -prune -o \
124+
-path "./build" -prune -o \
125+
-name "*.py" -print | while read -r script; do
121126
echo "checking ${script}"
122127
pylint -sn \
123128
--disable=W0012 \

tests.sh

Lines changed: 62 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,38 @@
55
# stop on first error
66
set -eu -o errtrace -o pipefail
77

8+
MULTI_PYTHON="" # set to test multi python envs
9+
PYTHON_VERSIONS=("3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14")
10+
11+
test()
12+
{
13+
echo "=> python version:"
14+
python3 --version
15+
16+
# test syntax
17+
echo "checking syntax..."
18+
"${cur}"/scripts/check-syntax.sh
19+
20+
# unittest
21+
echo "unittest..."
22+
"${cur}"/scripts/check-unittests.sh
23+
24+
# tests-ng
25+
if [ -n "${in_cicd}" ]; then
26+
# in CI/CD
27+
export DOTDROP_WORKERS=1
28+
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
29+
"${cur}"/scripts/check-tests-ng.sh
30+
31+
export DOTDROP_WORKERS=4
32+
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
33+
"${cur}"/scripts/check-tests-ng.sh
34+
else
35+
echo "tests-ng..."
36+
"${cur}"/scripts/check-tests-ng.sh
37+
fi
38+
}
39+
840
cur=$(cd "$(dirname "${0}")" && pwd)
941
in_cicd="${GITHUB_WORKFLOW:-}"
1042

@@ -24,32 +56,40 @@ if [ "${dotdrop_version}" != "${man_version}" ]; then
2456
fi
2557
echo "current dotdrop version ${dotdrop_version}"
2658

27-
echo "=> python version:"
28-
python3 --version
29-
30-
# test syntax
31-
echo "checking syntax..."
32-
"${cur}"/scripts/check-syntax.sh
33-
34-
# unittest
35-
echo "unittest..."
36-
"${cur}"/scripts/check-unittests.sh
37-
38-
# tests-ng
3959
if [ -n "${in_cicd}" ]; then
40-
# in CI/CD
41-
export DOTDROP_WORKERS=1
42-
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
43-
"${cur}"/scripts/check-tests-ng.sh
44-
45-
export DOTDROP_WORKERS=4
46-
echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..."
47-
"${cur}"/scripts/check-tests-ng.sh
60+
test
4861
else
49-
echo "tests-ng..."
50-
"${cur}"/scripts/check-tests-ng.sh
62+
if [ -n "${MULTI_PYTHON}" ]; then
63+
if ! hash pyenv &>/dev/null; then
64+
echo "install pyenv"
65+
exit 1
66+
fi
67+
68+
eval "$(pyenv init -)"
69+
for PY in "${PYTHON_VERSIONS[@]}"; do
70+
echo "============== python ${PY} =============="
71+
pyenv install -s "${PY}"
72+
pyenv shell "${PY}"
73+
python -m venv ".venv"
74+
source ".venv/bin/activate"
75+
pip install pip --upgrade
76+
pip install -r requirements.txt
77+
pip install -r tests-requirements.txt
78+
test
79+
deactivate
80+
done
81+
else
82+
python3 -m venv ".venv"
83+
source ".venv/bin/activate"
84+
pip install pip --upgrade
85+
pip install -r requirements.txt
86+
pip install -r tests-requirements.txt
87+
test
88+
deactivate
89+
fi
5190
fi
5291

92+
5393
# merge coverage
5494
coverage combine coverages/*
5595
coverage xml

0 commit comments

Comments
 (0)