diff --git a/.circleci/config.yml b/.circleci/config.yml index da2ad05..51b7f02 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2 jobs: - build: + integration_tests: docker: - image: circleci/python:3.6.2 steps: @@ -8,30 +8,16 @@ jobs: - run: name: install dependencies - command: | - python3 -m venv venv - . venv/bin/activate - pip install --upgrade pip setuptools wheel - pip install .[test] - - - run: - name: 'Check code formatting and do pylinting' - command: | - . venv/bin/activate - echo "Checking double quotes..." - find tap_snowflake tests -type f -name '*.py' | xargs unify --check-only - echo "Running pylint..." - pylint tap_snowflake tests + command: make venv - run: name: 'Integration Tests' command: | - . venv/bin/activate export LOGGING_CONF_FILE=$(pwd)/sample_logging.conf - nosetests --where=tests/integration/ + make integration_test workflows: version: 2 build: jobs: - - build + - integration_tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..33a2244 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +jobs: + lint_and_test: + name: Linting and Testing + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ 3.6, 3.7, 3.8 ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup virtual environment + run: make venv + + - name: Code formatting + run: make format + + - name: Pylinting + run: make pylint + +# No unit tests :( +# - name: Unit Tests +# run: make unit_test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7ab8888 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +venv: + python3 -m venv venv ;\ + . ./venv/bin/activate ;\ + pip install --upgrade pip setuptools wheel ;\ + pip install -e .[test] + +format: + . ./venv/bin/activate ;\ + find tap_snowflake tests -type f -name '*.py' | xargs unify --check-only + +pylint: + . ./venv/bin/activate ;\ + pylint --rcfile pylintrc tap_snowflake/ + +unit_test: + . ./venv/bin/activate ;\ + pytest tests/unit + +integration_test: + . ./venv/bin/activate ;\ + pytest tests/integration/ -vv --cov tap_snowflake diff --git a/README.md b/README.md index 26b622c..4b109d7 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,7 @@ installation instructions for [Mac](http://docs.python-guide.org/en/latest/start It's recommended to use a virtualenv: ```bash - python3 -m venv venv - pip install pipelinewise-tap-snowflake -``` - -or - -```bash - python3 -m venv venv - . venv/bin/activate - pip install --upgrade pip - pip install . +make venv ``` ### Configuration @@ -106,18 +96,29 @@ specified in the table's metadata as well. export TAP_SNOWFLAKE_WAREHOUSE= ``` -2. Install python dependencies in a virtual env and run nose unit and integration tests -``` - python3 -m venv venv - . venv/bin/activate - pip install --upgrade pip - pip install . - pip install nose +2. Install python dependencies +```bash +make venv ``` 3. To run unit tests: + +**PS**: There are no unit tests at the time of writing this document + +```bash +make unit_test +``` + +4. To run Integration tests +```bash +make integration_test ``` - nosetests + + +### To run formatting and linting: + +```bash +make venv format pylint ``` ## License diff --git a/setup.py b/setup.py index 45e4cbd..948e499 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup with open('README.md') as f: - long_description = f.read() + long_description = f.read() setup(name='pipelinewise-tap-snowflake', version='2.0.3', @@ -19,14 +19,14 @@ py_modules=['tap_snowflake'], install_requires=[ 'pipelinewise-singer-python==1.*', - 'snowflake-connector-python[pandas]==2.3.7', - 'pendulum==1.2.0', - 'python-dateutil>=2.1,<2.8.2' + 'snowflake-connector-python[pandas]==2.4.*', + 'pendulum==1.2.0' ], extras_require={ 'test': [ - 'nose==1.3.7', - 'pylint==2.6.0', + 'pylint==2.8.*', + 'pytest==6.2.*', + 'pytest-cov==2.12.*', 'unify==0.5' ] },