-
Notifications
You must be signed in to change notification settings - Fork 242
Autobuild: Improve and reorganize git/Changelog scripts (re-submission of #2584) #2656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5ecb376
c4d9573
979ef53
abd6fa7
b7745de
e97d32d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/usr/bin/python3 | ||
| #!/usr/bin/env python3 | ||
| # This script is trigged from the Github Autobuild workflow. | ||
| # It analyzes Jamulus.pro and git push details (tag vs. branch, etc.) to decide | ||
| # - whether a release should be created, | ||
|
|
@@ -32,26 +32,13 @@ def get_git_hash(): | |
| ]).decode('ascii').strip() | ||
|
|
||
|
|
||
| def write_changelog(version): | ||
| changelog = subprocess.check_output([ | ||
| 'perl', | ||
| f'{REPO_PATH}/.github/actions_scripts/getChangelog.pl', | ||
| f'{REPO_PATH}/ChangeLog', | ||
| version, | ||
| ]) | ||
| with open(f'{REPO_PATH}/autoLatestChangelog.md', 'wb') as f: | ||
| f.write(changelog) | ||
|
|
||
|
|
||
| def get_build_version(jamulus_pro_version): | ||
| if "dev" in jamulus_pro_version: | ||
| name = "{}-{}".format(jamulus_pro_version, get_git_hash()) | ||
| print("building an intermediate version: ", name) | ||
| return name | ||
| version = "{}-{}".format(jamulus_pro_version, get_git_hash()) | ||
| return 'intermediate', version | ||
|
|
||
| name = jamulus_pro_version | ||
| print("building a release version: ", name) | ||
| return name | ||
| version = jamulus_pro_version | ||
| return 'release', version | ||
|
|
||
|
|
||
| def set_github_variable(varname, varval): | ||
|
|
@@ -60,8 +47,9 @@ def set_github_variable(varname, varval): | |
|
|
||
|
|
||
| jamulus_pro_version = get_version_from_jamulus_pro() | ||
| write_changelog(jamulus_pro_version) | ||
| build_version = get_build_version(jamulus_pro_version) | ||
| set_github_variable("JAMULUS_PRO_VERSION", jamulus_pro_version) | ||
| build_type, build_version = get_build_version(jamulus_pro_version) | ||
| print(f'building a version of type "{build_type}": {build_version}') | ||
|
|
||
| fullref = os.environ['GITHUB_REF'] | ||
| publish_to_release = bool(re.match(r'^refs/tags/r\d+_\d+_\d+\S*$', fullref)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, can we either do this or do what line 36 ( I guess, ideally that means another function So
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't quite see yet how one could replace the other.
That would be possible, for sure.
With the current design, assumptions and constraints, we have to differentiate, I think.
I think this should be the case already. We use the workflow variable
I think there's certainly room for improvement, but it needs thorough checking to avoid breaking existing use cases (such as local builds). In addition, I don't think this PR introduces any additional inconsistencies. It might make existing strangeness more obvious (which is a good thing, IMO). Therefore, I'm a bit hesitant to squeeze in additional larger changes here.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern is Given we have three sources for the version, we really need automation to make sure they're aligned, at least: i.e. error out if things look wrong. But I agree, that's not in scope here. For that, it sounds like (and I don't fully understand how this works):
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. I've split that out into #2662 to track that. |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not keen on logging in this function. I'd rather it returned a tuple of the type and version and the caller could choose to log or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about that and I think I've just taken what was there.
I have now (mostly) applied your suggestion.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep wasn't fussed as it was already there. But as it was potentially useful information (i.e. build type), it might as well be exposed to the caller.
On which note - is the check for
devhere the consistent check now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed that part -- Github doesn't send notifications for edits.
Can you elaborate on what you mean here?