Skip to content

Commit

Permalink
Adding CI testing on multiple OS and python version (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitpagaria committed May 4, 2021
1 parent d22dac3 commit e109a3b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
60 changes: 35 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,40 @@ on:

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [3.7, 3.8, 3.9]
# experimental: [ false ]
# include:
# - python-version: 3.10
# experimental: true
# continue-on-error: ${{ matrix.experimental }}

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- 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 with pytest
run: |
python -m pytest
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- 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 with pytest
run: |
python -m spacy download en_core_web_lg
python -m pytest
4 changes: 2 additions & 2 deletions obsei/analyzer/pii_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def __init__(self, **data: Any):
# Check SpacyNlpEngine.engine_name
if self.engine_config.nlp_engine_name == "spacy":
try:
import spacy
spacy.load(model_config.model_name)
spacy_model = __import__(model_config.model_name)
spacy_model.load()
logger.info(f"Spacy model {model_config.model_name} is already downloaded")
except:
logger.warning(f"Spacy model {model_config.model_name} is not downloaded")
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ tldextract==3.1.0
# via presidio-analyzer
tokenizers==0.10.2
# via transformers
torch==1.8.1
torch==1.8.1; sys_platform != 'win32' and sys_platform != 'cygwin'
torch==1.8.1+cpu; sys_platform == 'win32' or sys_platform == 'cygwin'
# via -r requirements.in
tqdm==4.60.0
# via
Expand Down
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@pytest.fixture(scope="session")
def zero_shot_analyzer():
return ZeroShotClassificationAnalyzer(
model_name_or_path="joeddav/bart-large-mnli-yahoo-answers",
model_name_or_path="typeform/mobilebert-uncased-mnli",
)


Expand Down

0 comments on commit e109a3b

Please sign in to comment.