Skip to content

Commit

Permalink
Add GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
spladug committed Feb 8, 2021
1 parent 4e74b07 commit c5cfce4
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 31 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Lint and Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint-and-test:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.7, 3.8]

container:
image: python:${{ matrix.python-version }}

services:
cassandra:
image: cassandra:3
ports:
- 9090:9090

steps:
- uses: actions/checkout@v2

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

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install -r requirements-lint.txt
- name: Lint
run: |
make lint
- name: Test
run: |
nosetests
32 changes: 32 additions & 0 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools==47.3.0 wheel==0.34.2 twine==3.1.1
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.6

COPY ./requirements.txt ./requirements-dev.txt /src/
RUN pip install --no-index --find-links https://reddit-wheels.s3.amazonaws.com/index.html -r /src/requirements-dev.txt
RUN pip install -r /src/requirements-dev.txt

COPY . /src
WORKDIR /src
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Major changes:
as the `conn` argument to functions rather than using the `Model.batch`
syntax of cqlengine

Example usage:
::
Example usage::

import uuid

from cassandra.cluster import Cluster
Expand Down
11 changes: 6 additions & 5 deletions requirements-lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ flake8==3.7.7
flake8-docstrings==1.3.0
flake8-polyfill==1.0.2
isort==4.3.16
lazy-object-proxy==1.3.1
lxml==4.3.3
lazy-object-proxy==1.5.2
lxml==4.6.2
mccabe==0.6.1
mypy==0.701
mypy-extensions==0.4.1
mypy==0.800
mypy-extensions==0.4.3
pycodestyle==2.5.0
pydocstyle==3.0.0
pyflakes==2.1.1
pylint==2.3.1
reorder-python-imports==1.6.0
typed-ast==1.4.0
typed-ast==1.4.2
typing-extensions==3.7.4.3
wrapt==1.11.1
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cassandra-driver==3.17.0
cassandra-driver==3.24.0
six==1.12.0
6 changes: 3 additions & 3 deletions tests/integration/columns/test_container_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@

from datetime import datetime
from datetime import timedelta
from tests.integration import CASSANDRA_VERSION
from tests.integration import is_prepend_reversed
from tests.integration.base import BaseCassEngTestCase
from uuid import uuid4

import six
Expand All @@ -36,6 +33,9 @@
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from cqlmapper.models import ValidationError
from tests.integration import CASSANDRA_VERSION
from tests.integration import is_prepend_reversed
from tests.integration.base import BaseCassEngTestCase

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/columns/test_counter_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tests.integration.base import BaseCassEngTestCase
from uuid import uuid4

from cqlmapper import columns
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from cqlmapper.models import ModelDefinitionException
from tests.integration.base import BaseCassEngTestCase


class TestCounterModel(Model):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/management/test_compaction_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
import copy

from tests.integration.base import BaseCassEngTestCase
from unittest.mock import patch

import six
Expand All @@ -26,6 +25,7 @@
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration.base import BaseCassEngTestCase


class LeveledCompactionTestTable(Model):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/model/test_class_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
import warnings

from tests.integration.base import BaseCassEngTestCase
from uuid import uuid4

from cqlmapper import columns
Expand All @@ -25,6 +24,7 @@
from cqlmapper.models import ModelException
from cqlmapper.query import DMLQuery
from cqlmapper.query_set import ModelQuerySet
from tests.integration.base import BaseCassEngTestCase


class TestModelClassFunction(BaseCassEngTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/model/test_equality_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tests.integration.base import BaseCassEngTestCase
from uuid import uuid4

from cqlmapper import columns
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration.base import BaseCassEngTestCase


class TestModel(Model):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/model/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tests.integration.base import BaseCassEngTestCase
from unittest.mock import patch
from uuid import uuid4

Expand All @@ -22,6 +21,7 @@
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration.base import BaseCassEngTestCase


class TestUpdateModel(Model):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/model/test_value_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
# limitations under the License.
import random

from tests.integration.base import BaseCassEngTestCase

from cqlmapper import columns
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration.base import BaseCassEngTestCase


class TestModel(Model):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/query/test_datetime_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# limitations under the License.
from datetime import datetime
from datetime import timedelta
from tests.integration import execute_count
from tests.integration.base import BaseCassEngTestCase
from uuid import uuid4

from cqlmapper import columns
from cqlmapper.functions import get_total_seconds
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration import execute_count
from tests.integration.base import BaseCassEngTestCase


class DateTimeQueryTestModel(Model):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/query/test_queryoperators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from datetime import datetime
from tests.integration import execute_count
from tests.integration.base import BaseCassEngTestCase

from cqlmapper import columns
from cqlmapper import functions
Expand All @@ -25,6 +23,8 @@
from cqlmapper.models import Model
from cqlmapper.operators import EqualsOperator
from cqlmapper.statements import WhereClause
from tests.integration import execute_count
from tests.integration.base import BaseCassEngTestCase


class TestQuerySetOperation(BaseCassEngTestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/query/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tests.integration import execute_count
from tests.integration import is_prepend_reversed
from tests.integration.base import BaseCassEngTestCase
from uuid import uuid4

from cqlmapper import columns
from cqlmapper import ValidationError
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration import execute_count
from tests.integration import is_prepend_reversed
from tests.integration.base import BaseCassEngTestCase


class TestQueryUpdateModel(Model):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_batch_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# limitations under the License.
import warnings

from tests.integration import execute_count
from tests.integration.base import BaseCassEngTestCase
from unittest import mock

from cqlmapper import columns
Expand All @@ -25,6 +23,8 @@
from cqlmapper.management import drop_table
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration import execute_count
from tests.integration.base import BaseCassEngTestCase


class TestMultiKeyModel(Model):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tests.integration.base import BaseCassEngTestCase
from unittest import mock
from uuid import uuid4

Expand All @@ -28,6 +27,7 @@
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from cqlmapper.query_set import ModelQuerySet
from tests.integration.base import BaseCassEngTestCase


class TestConsistencyModel(Model):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

from datetime import datetime
from datetime import timedelta
from tests.integration.base import BaseCassEngTestCase
from tests.integration.base import main
from unittest import mock
from uuid import uuid4

from cqlmapper import columns
from cqlmapper.batch import Batch
from cqlmapper.management import sync_table
from cqlmapper.models import Model
from tests.integration.base import BaseCassEngTestCase
from tests.integration.base import main


class TestTimestampModel(Model):
Expand Down

0 comments on commit c5cfce4

Please sign in to comment.