diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a2cce25 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Tests +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install Dependencies + run: make install + + - name: Lint + run: make lint + + - name: Tests + run: make test + + publish: + needs: test + if: "success() && startsWith(github.ref, 'refs/tags/')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: set up python + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + - name: install + run: | + make install + pip install -U wheel twine + - name: build + run: python setup.py sdist bdist_wheel + + - run: twine check dist/* + + - name: upload to pypi + run: twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.pypi_password }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 964d9a0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python - -script: - - ls -hlR - -deploy: -- provider: pypi - user: samuelcolvin - password: - secure: JT5xecDyHp/zkc4K0MaOc89n9MtqnUbprIg07XJc4l59dTr6DSUihweDzi+6V8l4j+OWcxER9+ytnztcQIJp+smk4KNmKxNQIa61T2HmRZp7AwFszG7Z32alayllCocrwbOjChjvf7APgxQBFe5wG+f+4mwDgH5+XbY5TEAldLxnN9CERp5ai2+M/zFys3DRXmzrd6DEsf68/7gndnH2EU2mTaUwHT6gijbkr06JR1y4pDIO5Pb229Feb/Cua6KPQ6PDQYTZECSBNcNWMXNJYpRCXstqesPuebECFUnS8mar7M5sVimEC1LvWWt7eup8Hvm3xxcPWurbsAql1WGEWhn5SHOt2jRDYMODk1z+IhhuHKx8xfke/cxe27Jpw+PJ0m125wVgMaq6bPVFTxmnd6j8veqEb0JV85In/SWoGMgt/hfeDi7OBsrRgSPQqYaIvtLdgY7oHZ8RbVvlzXFsinQPjtCR5hjVd6d7JA0SHwG/HqPC2R/91jKR++sCkNmSRunIT9pYVKkBrTY1B63/HPK2P+3kcOsEvutaFURcwQ6PIIPo2dfWLNfRudHLpkg2LLNnigWV6rbP5YY0SRqGQpxicP1lnZp0WRxNolEPBYB/X1bl3aVUMAeIK9Cu1jxffrL1F+nGrbydH+a5RyIugJ/Sgkd46fNuMvrMZqHzxQI= - on: - tags: true diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d67b15d --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +black = black -S -l 120 --target-version py39 + +.PHONY: install +install: + pip install --progress-bar off -r requirements.txt + +.PHONY: black +black: + $(black) tests/ + +.PHONY: lint +lint: + flake8 tests/ + $(black) --check tests/ + +.PHONY: test +test: + tox \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8099395 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +black==22.6.0 +django>=1.10 +flake8==5.0.4 +tox==3.25.1 \ No newline at end of file diff --git a/setup.py b/setup.py index c90b4a0..7747591 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import pypandoc long_description = pypandoc.convert('README.md', 'rst') -VERSION = '2.8.2' +VERSION = '2.8.3' setup( name='django-bootstrap3-datetimepicker-2', diff --git a/tests/legacy.py b/tests/legacy.py index f9d7aad..59d9969 100644 --- a/tests/legacy.py +++ b/tests/legacy.py @@ -12,5 +12,5 @@ def build_attrs(self, base_attrs=None, extra_attrs=None, **kwargs): def is_legacy(): - x,y,z = [int(v) for v in django.__version__.split(".")] + x, y, z = [int(v) for v in django.__version__.split(".")] return x == 1 and y < 11 diff --git a/tests/test_widgets.py b/tests/test_widgets.py index 0dc8512..86c2158 100644 --- a/tests/test_widgets.py +++ b/tests/test_widgets.py @@ -8,5 +8,14 @@ def test_rendering(): options = {"pickTime": True, "format": "YYYY-MM-DD HH:mm"} widget = (DateTimePickerDjango110 if is_legacy() else DateTimePicker)(options=options) - expected_output = '\n