diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a4786e1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: python + package-name: pydantic-mongo + + - uses: actions/checkout@v3 + if: ${{ steps.release.outputs.release_created }} + + - name: Set up Python + uses: actions/setup-python@v4 + if: ${{ steps.release.outputs.release_created }} + with: + python-version: 3.9 + + - name: Build + if: ${{ steps.release.outputs.release_created }} + run: | + python -m pip install --upgrade pip + pip install wheel build + python -m build + + - name: Publish a Python distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: ${{ steps.release.outputs.release_created }} + with: + password: ${{ secrets.PYPI_API_TOKEN } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20981cf..8a9fdd4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ name: Tests -on: push +on: + push: + pull_request: jobs: build: runs-on: ubuntu-latest @@ -7,9 +9,9 @@ jobs: matrix: python-version: [3.7, 3.8, 3.9] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -17,7 +19,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements_test.txt - name: Test & publish code coverage - uses: paambaati/codeclimate-action@v2.7.5 + uses: paambaati/codeclimate-action@v3.2.0 env: CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} with: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/Makefile b/Makefile deleted file mode 100644 index fa54490..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -release: - rm -Rf build dist - python -m build - twine upload dist/* --verbose diff --git a/pydantic_mongo/__init__.py b/pydantic_mongo/__init__.py index 25f49ec..2497064 100644 --- a/pydantic_mongo/__init__.py +++ b/pydantic_mongo/__init__.py @@ -1,2 +1,3 @@ from .abstract_repository import AbstractRepository # noqa from .fields import ObjectIdField # noqa +from .version import __version__ # noqa diff --git a/pydantic_mongo/version.py b/pydantic_mongo/version.py new file mode 100644 index 0000000..5becc17 --- /dev/null +++ b/pydantic_mongo/version.py @@ -0,0 +1 @@ +__version__ = "1.0.0" diff --git a/requirements_test.txt b/requirements_test.txt index 9ef08a3..23710a5 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,6 +1,6 @@ mock coverage==5.2.1 -flake8==3.8.3 +flake8==5.0.4 phulpy==1.0.10 pytest==5.4.3 pytest-cov==2.10.0 @@ -8,5 +8,5 @@ pytest-mock==3.2.0 mongomock==3.23.0 pydantic==1.8.2 pymongo==4.3.3 -mypy==0.910 +mypy==0.991 mypy-extensions==0.4.3 diff --git a/setup.py b/setup.py index dd69cb7..9444274 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,23 @@ +import os from setuptools import setup -long_description = open('README.rst', 'r').read() +long_description = open("README.rst", "r").read() + +package_root = os.path.abspath(os.path.dirname(__file__)) + +version = {} +with open(os.path.join(package_root, "pydantic_mongo/version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] setup( - name='pydantic-mongo', - version='0.1.3', - packages=['pydantic_mongo'], - setup_requires=['wheel'], + name="pydantic-mongo", + version=version, + packages=["pydantic_mongo"], + setup_requires=["wheel"], install_requires=[ - 'pymongo>=4.3,<5.0', - 'pydantic>=1.6.2,<2.0.0' + "pymongo>=4.3,<5.0", + "pydantic>=1.6.2,<2.0.0" ], entry_points={ "console_scripts": [ @@ -18,16 +26,16 @@ }, description="Document object mapper for pydantic and pymongo", long_description=long_description, - url='https://github.com/jefersondaniel/pydantic-mongo', - author='Jeferson Daniel', - author_email='jeferson.daniel412@gmail.com', - license='MIT', + url="https://github.com/jefersondaniel/pydantic-mongo", + author="Jeferson Daniel", + author_email="jeferson.daniel412@gmail.com", + license="MIT", classifiers=[ - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ], python_requires=">=3.7" )