def publish_starter_project(self): self.commit_starter_project() self.push_starter_project() run([ "open", "https://github.com/approvals/ApprovalTests.cpp.StarterProject/commits/master" ]) check_step("that the starter project is published")
def publish_tweet(self): # Draft the tweet check_step( "that you have created a screenshot of the release notes, for the Tweet" ) tweet_text = F"'https://twitter.com/intent/tweet?text=%23ApprovalTests.cpp+{self.details.new_version}+released%2C+now+with+___%21%0D%0Ahttps%3A%2F%2Fgithub.com%2Fapprovals%2FApprovalTests.cpp%2Freleases%2Ftag%2F{self.details.new_version}+%0D%0Aor+try+the+starter+project%3A+https%3A%2F%2Fgithub.com%2Fapprovals%2FApprovalTests.cpp.StarterProject%0D%0AThanks+%40LlewellynFalco+%40ClareMacraeUK+%21'" run(["open", tweet_text]) check_step("that the tweet is published")
def upload_release_to_github(self): # Draft the upload to github release_notes = read_file(self.details.new_release_notes_path) pyperclip.copy(release_notes) print('The release notes are on the clipboard') github_url = F"'https://github.com/approvals/ApprovalTests.cpp/releases/new?tag={self.details.new_version}&title=Single%20Hpp%20File%20-%20{self.details.new_version}'" run(["open", github_url]) run(["open", self.details.release_dir]) check_step("that the release is published")
def update_conan_recipe(self): self.check_conan_repo() new_version_with_v = self.details.new_version new_version_without_v = version.get_version_without_v( self.details.new_version) # TODO Execute or show these commands... # cd conan-center-index-claremacrae # git pull upstream master # git push # git checkout -b approvaltests.cpp.8.4.0 check_step("Check out Conan master") check_step("Pull all changes in from upstream master") check_step( F"Create branch 'approvaltests.cpp.{new_version_without_v}', if it does not already exist" ) check_step( F"Check out branch 'approvaltests.cpp.{new_version_without_v}'") conan_approvaltests_dir = self.details.conan_approvaltests_dir self.update_conandata_yml(conan_approvaltests_dir, new_version_with_v, new_version_without_v) self.update_conan_config_yml(conan_approvaltests_dir, new_version_without_v)
def check_conan_repo(self): repo = Repo(self.details.conan_repo_dir) assert not repo.bare # TODO Add descriptions in case of failure assert (repo.active_branch.name == 'master') assert (len(repo.index.diff(None)) == 0) # Modified assert (len(repo.index.diff("HEAD")) == 0) # Staged run(["open", "https://github.com/conan-io/conan/releases"]) run(["conan", "--version"]) # TODO pip3 install --upgrade conan check_step("you are running the latest Conan release")
def test_conan_and_create_pr(self): # TODO Fix this directory name pushdir(self.details.conan_data_dir) # We cannot test the new Conan recipe until the new release has been # published on github new_version_without_v = version.get_version_without_v( self.details.new_version) run(['conan', 'create', '.', F'{new_version_without_v}@']) # TODO Commit the changes - with message f'Add approvaltests.cpp {new_version_without_v}' # TODO Push the changes - NB on the feature branch for the release popdir() check_step( "that you have created a Pull Request for conan-center-index?")
def update_features_page(self): features_file = '../doc/mdsource/Features.source.md' content = read_file(features_file) missing_features = F""" ## v.x.y.z ## {self.details.old_version} """ if missing_features in content: check_step( "the Features page is empty: are you sure you want this?") else: update_version = F""" ## v.x.y.z ## {self.details.new_version} """ replace_text_in_file(features_file, '\n## v.x.y.z\n', update_version)
def check_pre_conditions_for_publish(self): if self.details.push_to_production: repo = Repo(self.details.main_project_dir) assert not repo.bare assert (repo.active_branch.name == 'master') # From https://stackoverflow.com/questions/31959425/how-to-get-staged-files-using-gitpython assert len( repo.index.diff(None) ) == 0, "there are un-committed changes to ApprovalTests.cpp" # Modified assert len( repo.index.diff("HEAD") ) == 0, "there are un-committed changes to ApprovalTests.cpp" # Staged # From https://stackoverflow.com/questions/15849640/how-to-get-count-of-unpublished-commit-with-gitpython assert len( list(repo.iter_commits('master@{u}..master')) ) == 0, "there are un-pushed changes in ApprovalTests.cpp" run([ "open", "https://github.com/approvals/ApprovalTests.cpp/commits/master" ]) check_step("the builds are passing") run([ "open", "https://github.com/approvals/ApprovalTests.cpp/blob/master/build/relnotes_x.y.z.md" ]) run([ "open", F"https://github.com/approvals/ApprovalTests.cpp/compare/{self.details.old_version}...master" ]) check_step("the release notes are ready") run(["open", "https://github.com/approvals/ApprovalTests.cpp/issues"]) check_step("any issues resolved in this release are closed") run([ "open", "https://github.com/approvals/ApprovalTests.cpp/milestones" ]) check_step( "the milestone (if any) is up to date, including actual version number of release" )
def update_conan_recipe(self): self.check_conan_repo() new_version_with_v = self.details.new_version new_version_without_v = version.get_version_without_v( self.details.new_version) check_step("Check out Conan master") check_step("Pull all changes in from upstream master") check_step( F"Create branch 'approvaltests.cpp.{new_version_without_v}', if it does not already exist" ) check_step( F"Check out branch 'approvaltests.cpp.{new_version_without_v}'") conan_approvaltests_dir = os.path.join(self.details.conan_repo_dir, 'recipes', 'approvaltests.cpp') self.update_conandata_yml(conan_approvaltests_dir, new_version_with_v, new_version_without_v) self.update_conan_config_yml(conan_approvaltests_dir, new_version_without_v)
def test_conan_and_create_pr(self): pushdir(os.path.join(self.details.conan_approvaltests_dir, 'all')) # We cannot test the new Conan recipe until the new release has been # published on github new_version_without_v = version.get_version_without_v( self.details.new_version) run(['conan', 'create', '.', F'{new_version_without_v}@']) check_step( F"Commit the changes - with message 'Add approvaltests.cpp {new_version_without_v}'" ) check_step( 'Push the changes - NB on the feature branch for the release') popdir() print( F"Create a pull request, including this in the description: **approvaltests.cpp/{new_version_without_v}**" ) check_step( "that you have created a Pull Request for conan-center-index?")
def publish_on_reddit_optionally(self): # Announce on Reddit - maybe? run(["open", "https://www.reddit.com/r/cpp/"]) check_step("if you want to announce this on Reddit r/cpp")
def publish_starter_project(self): self.commit_starter_project() self.push_starter_project() check_step("that the starter project is published")