-
Notifications
You must be signed in to change notification settings - Fork 29
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
Automatically update version number by appending git hash #2724
Comments
I've found https://stackoverflow.com/questions/3442874/in-git-how-can-i-write-the-current-commit-hash-to-a-file-in-the-same-commit. In short, we can't add the hash before writing the file (since adding the hash will change the hash). One solution mentioned was to use the previous hash. Or we could use the post-checkout hook? Not sure how this works with updates, merge, cherry-pick etc. On https://softwareengineering.stackexchange.com/questions/333680/how-to-version-when-using-trunk-based-development it was mentioned:
Not sure if this can be automated (i.e. modified automatically on commit) - I did a brief search, and there seems to be odd cases where modifying file might have unexpected side effects. I hope one of you knows more of git hooks than I do :) I am getting the feeling that just adding "-alpha" to the version number after a release might be the easiest option (and would work for me, all I need is to distinguish current master from the last release). It would also follow the semantic versioning standard (https://semver.org/). One other idea:
|
Thanks for thoroughly investigating Joerg. I like the idea of sticking to SemVer but I'm worried we're going to have e.g. 'alpha' versions of releases that will never actually exist. e.g. at the moment we should probably be at 3.0-alpha which is fine as we will definitely release 3.0. As soon as that is out of the door, we bump the 'working' version to 3.1-alpha. Say we then discover a bug in 3.0 that requires an immediate fix so we need to release 3.0.1. Do we backport the bug fix to 3.0 and then release that or does it go into 3.1? I guess the answer will depend on how urgently the bug fix is needed? |
I would have said to use Maye not ideal, but KISS. |
While not ideal (the reg-exp becomes a bit too general, but I guess a sequence of int and dots, and then letters, digits, + would be ok). It looks a bit like the output of
The 447 seems to be the number of commits since ... the last tag or release or so? But (I think) again the problem: the doc is not part of a commit, it can use a hash. We can't add it to a commit, since this by itself changes the hash (unless we would be happy to add a previous tag, which would be good enough ... or we would manually add 'something' in every time we merge). |
I just found:
So doesn't really help, since I am on current master ... but thought to mention this, just in case :) I am getting more and more the feeling that just adding |
I'm inclined to agree with you. KISS. No additional dependencies. Just requires the reviewer of the first PR after a release to update the version 'number' in the two locations. (One of which is the doxygen config file.) Would @sergisiso and @TeranIvy be happy with this proposal? |
In order to prepare Fab for the next release: what exactly will the version number be: And what are we going to do after the release. My suggestion (as kiss) would be to then change the version number to be |
It's going to be 3.0. And yes, I agree with your suggestion. Probably it will be 3.0.1-dev and we'll change this to 3.1-dev as soon as anything significant gets merged. I thought SemVer only specified the first three digits as in x.y.z? |
Oh, thanks, I didn't check with SemVer. Three digits is fine ;) OK, then I'll update my scripts to support this.
So if we have something significant and release 3.1, this condition will automatically be fulfilled. I am still having second thoughts :( My best idea of handling 'dev' is to just ignore The way I see it, we could either:
Am I missing something? 3.0.0-dev somehow sounds like it's the development of 3.0.0, so I don't think that's ideal? Or would it be understood as 'development based on 3.0.0?'. Or is my 'rule' about versioning number comparison stupid/useless? I would prefer not to add custom comparison function for version numbers to Fab (since tuples pretty much do exactly what we need in version comparisons, i.e. ( |
We agreed to change the version number of master after the release to be I've marked this as NG-ARCH, since it is a requirement for my Fab work in NG-ARCH. |
I just hit this again in fparser - I was about to say I'd update the version number thanks to your pytest fix but then discovered that we already have:
which, as you can see, has been automatically created for us by (Sergi and I have a nasty feeling that |
Funny, we must have been looking at the same code. My issue was more that (for me) fparser 0.2 still reports version So that means this will mean we devs needs to remember to either update the file or do a pip install again. But I have to agree that this is unlikely to ever be an issue for us. One question: if (say) we decide that the next release will not be 3.0.1, but 3.1. Previously at that time this important change comes in, we would update the version from |
I have done #2818 to append |
I just noticed on https://spack.readthedocs.io/en/latest/packaging_guide.html, that they support |
I would keep the
in the spack package already works, we don't have to adopt their naming scheme |
You beat me to it, I realised as well that the spack version name is not derived from the package. So I'll leave it the way it is. Thanks! |
#2724 Updated version number to be 3.0.1-dev.
At the telco today, we agreed that the PSyclone version number (stored in
src/psyclone/version.py
and also indoc/reference_guide/doxygen.config
) should have the git hash of the last commit (to master) appended to it. This will enable people to see when they are working with a version checked-out of GitHub, as opposed to a released version.We could do this manually as part of the end-of-the-review process but it would be much better if we could automate it using a GitHub Action.
The text was updated successfully, but these errors were encountered: