diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eb8d4f1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI +on: push + +jobs: + ci: + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10"] + poetry-version: ["1.1.13"] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - uses: abatilo/actions-poetry@v2.0.0 + with: + poetry-version: ${{ matrix.poetry-version }} + - run: poetry install + - run: poetry build + - run: poetry run pytest + - run: poetry run pycodestyle releaser tests diff --git a/poetry.lock b/poetry.lock index 88cf051..84233ed 100644 --- a/poetry.lock +++ b/poetry.lock @@ -74,12 +74,12 @@ python-versions = ">=3.7" gitdb = ">=4.0.1,<5" [[package]] -name = "more-itertools" -version = "8.12.0" -description = "More routines for operating on iterables, beyond itertools" +name = "iniconfig" +version = "1.1.1" +description = "iniconfig: brain-dead simple config-ini parsing" category = "dev" optional = false -python-versions = ">=3.5" +python-versions = "*" [[package]] name = "packaging" @@ -94,14 +94,15 @@ pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" [[package]] name = "pluggy" -version = "0.13.1" +version = "1.0.0" description = "plugin and hook calling mechanisms for python" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6" [package.extras] dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] [[package]] name = "py" @@ -132,25 +133,24 @@ diagrams = ["railroad-diagrams", "jinja2"] [[package]] name = "pytest" -version = "5.4.3" +version = "7.1.2" description = "pytest: simple powerful testing with Python" category = "dev" optional = false -python-versions = ">=3.5" +python-versions = ">=3.7" [package.dependencies] atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} -attrs = ">=17.4.0" +attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} -more-itertools = ">=4.0.0" +iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<1.0" -py = ">=1.5.0" -wcwidth = "*" +pluggy = ">=0.12,<2.0" +py = ">=1.8.2" +tomli = ">=1.0.0" [package.extras] -checkqa-mypy = ["mypy (==v0.761)"] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] [[package]] name = "smmap" @@ -169,17 +169,17 @@ optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] -name = "wcwidth" -version = "0.2.5" -description = "Measures the displayed width of unicode strings in a terminal" +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.7" [metadata] lock-version = "1.1" -python-versions = "^3.10" -content-hash = "dec65b4b10e8376da432a4241d0553009a04c8fd6e51a102e24bee39124f0cbd" +python-versions = "^3.8" +content-hash = "0e4abd402e1a18356ca6bd08b874a21f142eed489e573ed49bac813fc70fbb28" [metadata.files] atomicwrites = [ @@ -210,17 +210,17 @@ gitpython = [ {file = "GitPython-3.1.27-py3-none-any.whl", hash = "sha256:5b68b000463593e05ff2b261acff0ff0972df8ab1b70d3cdbd41b546c8b8fc3d"}, {file = "GitPython-3.1.27.tar.gz", hash = "sha256:1c885ce809e8ba2d88a29befeb385fcea06338d3640712b59ca623c220bb5704"}, ] -more-itertools = [ - {file = "more-itertools-8.12.0.tar.gz", hash = "sha256:7dc6ad46f05f545f900dd59e8dfb4e84a4827b97b3cfecb175ea0c7d247f6064"}, - {file = "more_itertools-8.12.0-py3-none-any.whl", hash = "sha256:43e6dd9942dffd72661a2c4ef383ad7da1e6a3e968a927ad7a6083ab410a688b"}, +iniconfig = [ + {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, + {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] packaging = [ {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, ] pluggy = [ - {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, - {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] py = [ {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, @@ -235,8 +235,8 @@ pyparsing = [ {file = "pyparsing-3.0.8.tar.gz", hash = "sha256:7bf433498c016c4314268d95df76c81b842a4cb2b276fa3312cfb1e1d85f6954"}, ] pytest = [ - {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"}, - {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"}, + {file = "pytest-7.1.2-py3-none-any.whl", hash = "sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c"}, + {file = "pytest-7.1.2.tar.gz", hash = "sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"}, ] smmap = [ {file = "smmap-5.0.0-py3-none-any.whl", hash = "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94"}, @@ -246,7 +246,7 @@ toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] -wcwidth = [ - {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, - {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, +tomli = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] diff --git a/pyproject.toml b/pyproject.toml index e966082..12c558f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,21 +1,22 @@ [tool.poetry] name = "releaser" -version = "0.1.0" +version = "2022.5.0" description = "" authors = ["Piper McCorkle "] [tool.poetry.dependencies] -python = "^3.10" +python = "^3.8" click = "^8.1.3" GitPython = "^3.1.27" [tool.poetry.dev-dependencies] -pytest = "^5.2" +pytest = "^7.1.2" autopep8 = "^1.6.0" +pycodestyle = "^2.8.0" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] -releaser = 'releaser.cli:releaser' \ No newline at end of file +releaser = 'releaser.cli:releaser' diff --git a/releaser/cli.py b/releaser/cli.py index f2709b2..912a63b 100644 --- a/releaser/cli.py +++ b/releaser/cli.py @@ -41,7 +41,8 @@ def update(): print(" git push --tags") -@releaser.command(help="Exits with code zero if this commit is tagged with a valid version number, non-zero otherwise") +@releaser.command(help="Exits with code zero if this commit is tagged with a" + + " valid version number, non-zero otherwise") def check_tag(): project = Project() version = project.tagged_version() diff --git a/releaser/project.py b/releaser/project.py index f6cd763..9d48402 100644 --- a/releaser/project.py +++ b/releaser/project.py @@ -5,7 +5,8 @@ from git import Commit, Repo from releaser.io import default_git_actor, prepend -from releaser.versions import Version, format_version, increment_version, parse_version +from releaser.versions import \ + Version, format_version, increment_version, parse_version class Project: @@ -24,7 +25,7 @@ def current_version(self) -> Optional[Version]: with open(self.release_notes_path(), "r") as f: firstline = f.readline().strip().removeprefix("# ") return parse_version(firstline) - except: + except Exception: return None def next_version(self) -> Version: @@ -35,7 +36,8 @@ def commits_since_current_version(self) -> Iterator[Commit]: if current_version is None: return self.repo.iter_commits(rev="HEAD") else: - return self.repo.iter_commits(rev=f"{format_version(current_version)}..HEAD") + formatted = format_version(current_version) + return self.repo.iter_commits(rev=f"{formatted}..HEAD") def generate_changelog_entry(self, new_version=None): if new_version is None: @@ -68,6 +70,6 @@ def tagged_version(self) -> Optional[Version]: if tag.commit == head: try: return parse_version(tag.name) - except: + except Exception: pass return None