Skip to content

Commit da91d4b

Browse files
authored
Merge pull request #498 from bact/refactor-gh-actions
Refactor GitHub Actions
2 parents edfbd5c + ad7f7ab commit da91d4b

File tree

5 files changed

+56
-28
lines changed

5 files changed

+56
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
1+
name: Lint
32

4-
name: PyThaiNLP Test
5-
6-
on: [push,pull_request]
3+
on: [push]
74

85
jobs:
96
build:
107

11-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
129
strategy:
1310
matrix:
14-
python-version: [3.7]
11+
python-version: [3.x]
1512

1613
steps:
1714
- uses: actions/checkout@v2
@@ -21,20 +18,16 @@ jobs:
2118
python-version: ${{ matrix.python-version }}
2219
- name: Install dependencies
2320
run: |
24-
python -m pip install --upgrade pip pytest wheel flake8 flake8-commas flake8-comprehensions
21+
python -m pip install --upgrade pip
2522
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2623
pip install "h5py>=2.10.0,<3" "tensorflow>=2.3.1,<3"
2724
pip install torch==1.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
25+
pip install deepcut
2826
pip install .[full]
29-
pip install deepcut coverage coveralls
27+
pip install flake8 flake8-commas flake8-comprehensions flake8-tidy-imports
3028
- name: Lint with flake8
3129
run: |
3230
# stop the build if there are Python syntax errors or undefined names
3331
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3432
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3533
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36-
- name: Test
37-
env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
run: |
39-
coverage run -m unittest discover
40-
CI_BRANCH=${GITHUB_REF#"ref/heads"} COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} coveralls
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
name: Upload Python Package
1+
name: Upload package to PyPI
52

63
on:
74
release:
@@ -11,13 +8,16 @@ jobs:
118
deploy:
129

1310
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
1414

1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Set up Python
17+
- name: Set up Python ${{ matrix.python-version }}
1818
uses: actions/setup-python@v1
1919
with:
20-
python-version: '3.x'
20+
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Unit test and code coverage
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install pytest coverage coveralls
23+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
24+
pip install "h5py>=2.10.0,<3" "tensorflow>=2.3.1,<3"
25+
pip install torch==1.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
26+
pip install deepcut
27+
pip install .[full]
28+
- name: Test
29+
env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
run: |
31+
coverage run -m unittest discover
32+
CI_BRANCH=${GITHUB_REF#"ref/heads"} COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} coveralls

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ install:
9595
- python --version
9696
- python -m pip install --disable-pip-version-check --user --upgrade pip setuptools
9797
- pip --version
98-
- pip install -U coveralls[yaml]
99-
- pip install -U coverage
10098
- pip install -U "h5py>=2.10.0,<3" "tensorflow>=2.3.1,<3" deepcut
10199
- pip install torch==1.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
102100
- pip install %PYICU_PKG%

tox.ini

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[tox]
2-
envlist = py36,flake8
2+
envlist=py{36,37,38,39,py3},flake8
3+
skip_missing_interpreters = true
34

45
[testenv]
56
setenv = PYTHONPATH = {toxinidir}:{toxinidir}/pythainlp
@@ -12,11 +13,15 @@ deps = discover
1213
; deps =
1314
; -r{toxinidir}/requirements.txt
1415

15-
[flake8]
16-
exclude = **/.ipynb_checkpoints,
17-
1816
[testenv:flake8]
1917
basepython = python
20-
deps = flake8
21-
commands = flake8 pythainlp
18+
deps =
19+
flake8
20+
flake8-commas
21+
flake8-comprehensions
22+
flake8-tidy-imports
23+
commands =
24+
flake8 pythainlp
2225

26+
[flake8]
27+
exclude = **/.ipynb_checkpoints,

0 commit comments

Comments
 (0)