Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
piperswe committed May 2, 2022
1 parent 7404791 commit bdcf403
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 40 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- run: poetry install
- run: poetry build
- run: poetry run pytest
- run: poetry run pycodestyle releaser tests
62 changes: 31 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[tool.poetry]
name = "releaser"
version = "0.1.0"
version = "2022.5.0"
description = ""
authors = ["Piper McCorkle <[email protected]>"]

[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'
releaser = 'releaser.cli:releaser'
3 changes: 2 additions & 1 deletion releaser/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 6 additions & 4 deletions releaser/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit bdcf403

Please sign in to comment.