From a4a1798aa42dd8febf825df702300b07dbad645f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=C5=9Aliwi=C5=84ski?= Date: Thu, 20 Jul 2023 14:05:00 +0200 Subject: [PATCH] Replace bumpversion with tbump - closes #386 --- .bumpversion.cfg | 17 ---- .github/workflows/pr-check.yml | 20 ++--- Pipfile | 1 + Pipfile.lock | 140 ++++++++++++++++++++++++++++++--- newsfragments/386.misc.rst | 1 + pyproject.toml | 56 ++++++++++++- 6 files changed, 195 insertions(+), 40 deletions(-) delete mode 100644 .bumpversion.cfg create mode 100644 newsfragments/386.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 5ae9be6..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,17 +0,0 @@ -[bumpversion] -current_version = 2.1.1 -commit = True -tag = True -message = "Release {new_version}" - -[bumpversion:file:setup.cfg] -search = version = {current_version} -replace = version = {new_version} - -[bumpversion:file:src/pytest_mongo/__init__.py] - -[bumpversion:file:CHANGES.rst] -search = unreleased - ---------- -replace = {new_version} - ---------- diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index b880b5e..121d281 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -5,16 +5,16 @@ on: branches: [ main ] jobs: -# bump: -# runs-on: ubuntu-latest -# steps: -# - name: Check out repository -# uses: actions/checkout@v3 -# - uses: fizyk/actions-reuse/.github/actions/pipenv@v2.2.1 -# with: -# python-version: "3.11" -# pipenv-install-options: "--skip-lock" -# command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x" + bump: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + - uses: fizyk/actions-reuse/.github/actions/pipenv@v2.2.1 + with: + python-version: "3.11" + pipenv-install-options: "--skip-lock" + command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x" towncrier: runs-on: ubuntu-latest if: ${{ github.actor != 'dependabot[bot]' }} diff --git a/Pipfile b/Pipfile index 12bd2d2..33e0826 100644 --- a/Pipfile +++ b/Pipfile @@ -16,3 +16,4 @@ pytest-cov = "==4.1.0" pytest-xdist = "==3.3.1" ruff = "==0.0.278" mypy = "==1.4.1" +tbump = "==6.10.0" diff --git a/Pipfile.lock b/Pipfile.lock index a24d6fa..109e23c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "03fc4011e7fae317407cda3bb627822d29b690e6f742e1d4b32062bd28a3ee25" + "sha256": "a9382ad46cb08f8164b1c353bf3d41ae00aa42031783776c68dfc989ed2405a4" }, "pipfile-spec": 6, "requires": {}, @@ -14,13 +14,53 @@ ] }, "default": { + "anyio": { + "hashes": [ + "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780", + "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5" + ], + "markers": "python_version >= '3.7'", + "version": "==3.7.1" + }, + "certifi": { + "hashes": [ + "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7", + "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716" + ], + "markers": "python_version >= '3.6'", + "version": "==2023.5.7" + }, "dnspython": { "hashes": [ - "sha256:224e32b03eb46be70e12ef6d64e0be123a64e621ab4c0822ff6d450d52a540b9", - "sha256:89141536394f909066cabd112e3e1a37e4e654db00a25308b0f130bc3152eb46" + "sha256:46b4052a55b56beea3a3bdd7b30295c292bd6827dd442348bc116f2d35b17f0a", + "sha256:758e691dbb454d5ccf4e1b154a19e52847f79e21a42fef17b969144af29a4e6c" ], - "markers": "python_version >= '3.7' and python_version < '4.0'", - "version": "==2.3.0" + "markers": "python_version >= '3.8' and python_version < '4.0'", + "version": "==2.4.0" + }, + "h11": { + "hashes": [ + "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d", + "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761" + ], + "markers": "python_version >= '3.7'", + "version": "==0.14.0" + }, + "httpcore": { + "hashes": [ + "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888", + "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87" + ], + "markers": "python_version >= '3.8'", + "version": "==0.17.3" + }, + "idna": { + "hashes": [ + "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4", + "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2" + ], + "markers": "python_version >= '3.5'", + "version": "==3.4" }, "iniconfig": { "hashes": [ @@ -169,6 +209,14 @@ ], "index": "pypi", "version": "==7.4.0" + }, + "sniffio": { + "hashes": [ + "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101", + "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384" + ], + "markers": "python_version >= '3.7'", + "version": "==1.3.0" } }, "develop": { @@ -200,13 +248,21 @@ "index": "pypi", "version": "==23.7.0" }, + "cli-ui": { + "hashes": [ + "sha256:2f67e50cf474e76ad160c3e660bbad98bf8b8dfb8d847765f3a261b7e13c05fa", + "sha256:6a1ebdbbcd83a0fa06b2f63f4434082a3ba8664aebedd91f1ff86b9e4289d53e" + ], + "markers": "python_version >= '3.7' and python_version < '4.0'", + "version": "==0.17.2" + }, "click": { "hashes": [ - "sha256:4be4b1af8d665c6d942909916d31a213a106800c47d0eeba73d34da3cbc11367", - "sha256:e576aa487d679441d7d30abb87e1b43d24fc53bffb8758443b1a9e1cee504548" + "sha256:48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd", + "sha256:fa244bb30b3b5ee2cae3da8f55c9e5e0c0e86093306301fb418eb9dc40fbded5" ], "markers": "python_version >= '3.7'", - "version": "==8.1.5" + "version": "==8.1.6" }, "click-default-group": { "hashes": [ @@ -214,6 +270,22 @@ ], "version": "==1.2.2" }, + "colorama": { + "hashes": [ + "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", + "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'", + "version": "==0.4.6" + }, + "contextlib2": { + "hashes": [ + "sha256:3fbdb64466afd23abaf6c977627b75b6139a5a3e8ce38405c5b413aed7a0471f", + "sha256:ab1e2bfe1d01d968e1b7e8d9023bc51ef3509bba217bb730cee3827e1ee82869" + ], + "markers": "python_version >= '3.6'", + "version": "==21.6.0" + }, "coverage": { "extras": [ "toml" @@ -283,6 +355,12 @@ "markers": "python_version >= '3.7'", "version": "==7.2.7" }, + "docopt": { + "hashes": [ + "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491" + ], + "version": "==0.6.2" + }, "execnet": { "hashes": [ "sha256:88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41", @@ -428,11 +506,11 @@ }, "platformdirs": { "hashes": [ - "sha256:cec7b889196b9144d088e4c57d9ceef7374f6c39694ad1577a0aab50d27ea28c", - "sha256:f87ca4fcff7d2b0f81c6a748a77973d7af0f4d526f98f308477c3c436c74d528" + "sha256:1b42b450ad933e981d56e59f1b97495428c9bd60698baab9f3eb3d00d5822421", + "sha256:ad8291ae0ae5072f66c16945166cb11c63394c7a3ad1b1bc9828ca3162da8c2f" ], "markers": "python_version >= '3.7'", - "version": "==3.8.1" + "version": "==3.9.1" }, "pluggy": { "hashes": [ @@ -489,6 +567,38 @@ "index": "pypi", "version": "==0.0.278" }, + "schema": { + "hashes": [ + "sha256:f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197", + "sha256:f3ffdeeada09ec34bf40d7d79996d9f7175db93b7a5065de0faa7f41083c1e6c" + ], + "version": "==0.7.5" + }, + "tabulate": { + "hashes": [ + "sha256:0ba055423dbaa164b9e456abe7920c5e8ed33fcc16f6d1b2f2d152c8e1e8b4fc", + "sha256:436f1c768b424654fce8597290d2764def1eea6a77cfa5c33be00b1bc0f4f63d", + "sha256:6c57f3f3dd7ac2782770155f3adb2db0b1a269637e42f27599925e64b114f519" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", + "version": "==0.8.10" + }, + "tbump": { + "hashes": [ + "sha256:170a4395d167daee357cb96af5e874119c470feaba9f605e73f3426e768c2542", + "sha256:9ebf5d69bc92ca8be1afb13a80f51e374526cb9988f4c3b167036a9e8a10a684" + ], + "index": "pypi", + "version": "==6.10.0" + }, + "tomlkit": { + "hashes": [ + "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171", + "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3" + ], + "markers": "python_version >= '3.7'", + "version": "==0.11.8" + }, "towncrier": { "hashes": [ "sha256:da552f29192b3c2b04d630133f194c98e9f14f0558669d427708e203fea4d0a5", @@ -504,6 +614,14 @@ ], "markers": "python_version >= '3.7'", "version": "==4.7.1" + }, + "unidecode": { + "hashes": [ + "sha256:547d7c479e4f377b430dd91ac1275d593308dce0fc464fb2ab7d41f82ec653be", + "sha256:fed09cf0be8cf415b391642c2a5addfc72194407caee4f98719e40ec2a72b830" + ], + "markers": "python_version >= '3.5'", + "version": "==1.3.6" } } } diff --git a/newsfragments/386.misc.rst b/newsfragments/386.misc.rst new file mode 100644 index 0000000..c3c51bd --- /dev/null +++ b/newsfragments/386.misc.rst @@ -0,0 +1 @@ +Replace bumpversion with tbump to manage versioning and releases \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7a5cbde..9c2fd56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ select = [ directory = "newsfragments" single_file=true filename="CHANGES.rst" -issue_format="`#{issue} `_" +issue_format="`#{issue} `__" [tool.towncrier.fragment.feature] name = "Features" @@ -100,4 +100,56 @@ name = "Miscellaneus" showcontent = false [tool.tbump.version] -current = "2.1.1" \ No newline at end of file +current = "2.1.1" + +# Example of a semver regexp. +# Make sure this matches current_version before +# using tbump +regex = ''' + (?P\d+) + \. + (?P\d+) + \. + (?P\d+) + (\- + (?P.+) + )? + ''' + +[tool.tbump.git] +message_template = "Release {new_version}" +tag_template = "v{new_version}" + +[[tool.tbump.field]] +# the name of the field +name = "extra" +# the default value to use, if there is no match +default = "" +# For each file to patch, add a [[file]] config +# section containing the path of the file, relative to the +# tbump.toml location. + +[[tool.tbump.file]] +src = "pytest_mongo/__init__.py" + +[[tool.tbump.file]] +src = "pyproject.toml" +search = 'version = "{current_version}"' + +[[tool.tbump.file]] +src = "pyproject.toml" +search = '"Changelog" = "https://github.com/ClearcodeHQ/pytest-mongo/blob/v{current_version}/CHANGES.rst"' + +# You can specify a list of commands to +# run after the files have been patched +# and before the git commit is made + +[[tool.tbump.before_commit]] +name = "Build changelog" +cmd = "pipenv run towncrier build --version {new_version} --yes" + +# Or run some commands after the git tag and the branch +# have been pushed: +# [[tool.tbump.after_push]] +# name = "publish" +# cmd = "./publish.sh" \ No newline at end of file