diff --git a/.github/workflows/pythainlp-test.yml b/.github/workflows/lint.yml similarity index 56% rename from .github/workflows/pythainlp-test.yml rename to .github/workflows/lint.yml index 67759bf3d..f20faa9a0 100644 --- a/.github/workflows/pythainlp-test.yml +++ b/.github/workflows/lint.yml @@ -1,17 +1,14 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions +name: Lint -name: PyThaiNLP Test - -on: [push,pull_request] +on: [push] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7] + python-version: [3.x] steps: - uses: actions/checkout@v2 @@ -21,20 +18,16 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip pytest wheel flake8 flake8-commas flake8-comprehensions + python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install "h5py>=2.10.0,<3" "tensorflow>=2.3.1,<3" pip install torch==1.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html + pip install deepcut pip install .[full] - pip install deepcut coverage coveralls + pip install flake8 flake8-commas flake8-comprehensions flake8-tidy-imports - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coverage run -m unittest discover - CI_BRANCH=${GITHUB_REF#"ref/heads"} COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} coveralls diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pypi-publish.yml similarity index 62% rename from .github/workflows/pythonpublish.yml rename to .github/workflows/pypi-publish.yml index d5f3859d1..840158d78 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,7 +1,4 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package +name: Upload package to PyPI on: release: @@ -11,13 +8,16 @@ jobs: deploy: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] steps: - uses: actions/checkout@v2 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 with: - python-version: '3.x' + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..6fbbc2503 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Unit test and code coverage + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest coverage coveralls + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install "h5py>=2.10.0,<3" "tensorflow>=2.3.1,<3" + pip install torch==1.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html + pip install deepcut + pip install .[full] + - name: Test + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + coverage run -m unittest discover + CI_BRANCH=${GITHUB_REF#"ref/heads"} COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} coveralls diff --git a/appveyor.yml b/appveyor.yml index f25b82368..2133125f3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -95,8 +95,6 @@ install: - python --version - python -m pip install --disable-pip-version-check --user --upgrade pip setuptools - pip --version - - pip install -U coveralls[yaml] - - pip install -U coverage - pip install -U "h5py>=2.10.0,<3" "tensorflow>=2.3.1,<3" deepcut - pip install torch==1.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html - pip install %PYICU_PKG% diff --git a/tox.ini b/tox.ini index 4c1d71eaa..7be0f5299 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] -envlist = py36,flake8 +envlist=py{36,37,38,39,py3},flake8 +skip_missing_interpreters = true [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/pythainlp @@ -12,11 +13,15 @@ deps = discover ; deps = ; -r{toxinidir}/requirements.txt -[flake8] -exclude = **/.ipynb_checkpoints, - [testenv:flake8] basepython = python -deps = flake8 -commands = flake8 pythainlp +deps = + flake8 + flake8-commas + flake8-comprehensions + flake8-tidy-imports +commands = + flake8 pythainlp +[flake8] +exclude = **/.ipynb_checkpoints,