Skip to content

Commit 976bea8

Browse files
committed
Use variables for latest Python version
1 parent 7aee41a commit 976bea8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/unittest.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
PYICU_WIN_VER: 2.14
2626
INSTALL_TORCH: false
2727
INSTALL_FULL_DEPS: false
28+
PYTHON_VERSION_LATEST: "3.13"
29+
PYTHON_VERSION_LATEST_2: "3.12"
2830

2931
steps:
3032
- name: Checkout
@@ -71,10 +73,10 @@ jobs:
7173
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
7274
run: pip install -r docker_requirements.txt
7375
- name: Install PyThaiNLP + dependencies (minimum)
74-
if: matrix.python-version != '3.12' && matrix.python-version != '3.13'
76+
if: matrix.python-version != env.PYTHON_VERSION_LATEST && matrix.python-version != env.PYTHON_VERSION_LATEST_2
7577
run: pip install .
7678
- name: Install PyThaiNLP + dependencies (compact)
77-
if: matrix.python-version == '3.12' || matrix.python-version == '3.13'
79+
if: matrix.python-version == env.PYTHON_VERSION_LATEST || matrix.python-version == env.PYTHON_VERSION_LATEST_2
7880
run: pip install ".[compact]"
7981
# If you want to install a safe small set of optional dependencies, use:
8082
# pip install ".[compact]"
@@ -83,23 +85,24 @@ jobs:
8385
# of dependencies to avoid the conflict between dependencies.
8486
# See: https://github.com/PyThaiNLP/pythainlp/issues/935
8587
- name: Unit test (core)
86-
if: matrix.python-version != '3.12' && matrix.python-version != '3.13'
88+
if: matrix.python-version != env.PYTHON_VERSION_LATEST && matrix.python-version != env.PYTHON_VERSION_LATEST_2
8789
env:
8890
PYTHONIOENCODING: utf-8
8991
run: coverage run -m unittest tests.core
9092
- name: Unit test (core + compact)
91-
if: matrix.python-version == '3.12' || matrix.python-version == '3.13'
93+
if: matrix.python-version == env.PYTHON_VERSION_LATEST || matrix.python-version == env.PYTHON_VERSION_LATEST_2
9294
env:
9395
PYTHONIOENCODING: utf-8
9496
run: coverage run -m unittest tests.core tests.compact
97+
# Only test "compact" set with the latest two stable Python versions.
9598
# Use 'unittest <test_module>' instead of 'unittest discover' to avoid
9699
# loading tests with dependencies more than expected.
97100
# Test cases loaded is defined in __init__.py in the tests directory.
98101
# See also tests/README.md
99102
- name: Coverage report
100-
if: matrix.python-version == '3.13'
103+
if: matrix.python-version == env.PYTHON_VERSION_LATEST
101104
env:
102105
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103106
COVERALLS_SERVICE_NAME: github
104107
run: coveralls
105-
# Submit only from the latest Python version
108+
# Only submit a report from the latest Python version

0 commit comments

Comments
 (0)