| # SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project | |
| # SPDX-License-Identifier: CC0-1.0 | |
| name: PyPI Unit test | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Once per day | |
| jobs: | |
| pypi-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| env: | |
| SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True | |
| run: | | |
| python -m pip install --upgrade "pip<24.1" setuptools | |
| python -m pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt | |
| python -m pip install pythainlp[full] | |
| python -m nltk.downloader omw-1.4 | |
| - name: Test | |
| run: | | |
| mkdir pythainlp_test | |
| cd pythainlp_test | |
| pip download --no-binary=:all: --no-dependencies pythainlp | |
| file="find . -name *.tar.gz" | |
| file=$(eval "$file") | |
| tar -xvzf $file --one-top-level | |
| second="/" | |
| path=${file//.tar.gz/$second} | |
| cd $path | |
| ls | |
| cd tests | |
| mkdir tests | |
| mv data tests/ | |
| python -m unittest discover | |