-
Notifications
You must be signed in to change notification settings - Fork 3
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
Setup release process and other improvements #4
Conversation
c9b8dd8
to
3adb58e
Compare
4a3b3ee
to
46ff8ce
Compare
97988fa
to
4045e90
Compare
Hey @stalep , with this PR I implemented a further simplication to the repository:
|
Awesome!!
Yes, that would be good to have I think.
|
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.
Hi @lampajr, here are some nits for you to consider.
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'backport-squash')) | ||
|| (github.event.action == 'labeled' && contains(github.event.label.name, 'backport-squash')) |
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.
Again, I would factor out the common condition:
(github.event.action == 'closed' || github.event.action == 'labeled') &&
&& contains(github.event.label.name, 'backport-squash')
although I doubt that you need the github.event.action
check, because I don't think this will run if neither of those is true, per the check at line 21.
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 need the github.event.action
check as I am performing two different checks based on that result:
github.event.action == 'closed'
--> checkgithub.event.pull_request.labels.*.name
github.event.action == 'labeled'
--> checkgithub.event.label.name
NOTE:
github.event.label.name
is present if and only if the event islabeled
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.
Ah, I see.
But, if github.event.action == 'labeled'
is true, then github.event.pull_request.labels.*.name
should contain the updated value (right?), so you can check that instead of github.event.label.name
, which should let you simplify this to a single condition.
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.
That's true, but if I check github.event.pull_request.labels.*.name
when adding a label I am actually checking if at least one label with that name exists, which is true even if I am adding a new label and backport
already exists on that pul request. This is not what we want as it would trigger the workflow multiple times.
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.
Good point...but, I think that applies to my previous suggestion (which I shall withdraw 🙂).
In this spot, we've already decided to run the workflow, so the only question is whether to squash or not, and for that I think you can check github.event.pull_request.labels.*.name
in either case.
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.
See other comment #4 (comment) I don't think that is enough to check backport
word. Anyway we are talking about minors so not a big deal
@pytest.fixture() | ||
async def anonymous_client_without_check() -> HorreumClient: | ||
print("Setting up anonymous client") | ||
return await new_horreum_client(base_url="http://localhost:8080") | ||
|
||
|
||
@pytest.fixture() | ||
async def anonymous_client() -> HorreumClient: | ||
print("Setting up anonymous client") | ||
client = await new_horreum_client(base_url="http://localhost:8080") |
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 believe that you can have fixtures depend on other fixtures, in which case you can remove this duplication.
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.
yeah they should work with nested fixtures, I think the whole test infrastructure should be optimized/refactored but I would do in ad-hoc PRs
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.
For further improvements #5
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.
Some followup comments and a few new small things on your update.
Push changes and tag: | ||
```bash | ||
git push origin main | ||
git push origin v0.12 | ||
``` |
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.
right now I would keep it as simple as possible (at least until we have a first package release) then we can improve it.
That's fair.
In the future all pushes to main could be converted to automated pull request creation
Sure, but, as a general rule, pushes to main
and other "special branches" should be disallowed and forced to go through a pull request.
What is weird here is that this procedure implies that creating a release requires changes to the main
branch. It really shouldn't -- you should be able to create a release from any point on main
. Now, it is true that, once you create a release, any files on main
which contain information related to the release name should probably be updated, but even that is not necessarily true (it depends on how you are naming your releases, and whether main
carries a versioned release name, and whether the current contents of main
are actually targeted at a new release).
### Tag a new version | ||
|
||
Checkout to your branch, either a "stable" (e.g., `0.12.x`) or the `main` one. | ||
|
||
```bash | ||
git checkout origin/main | ||
``` |
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.
You really should, first, do a command like
git remote update [--prune]
to ensure that the origin/main
tracking branch is actually up to date with the remote origin
repo before you create a local branch from it.
Then, when you do the checkout, you need to specify the name of the local branch to create (otherwise, at least in my environment, you end up in "detached HEAD state"):
git checkout origin/main -b main
(If you maintain a local main
branch which you keep up to date with the origin/main
by doing periodic pull
's, perhaps this doesn't apply -- I don't keep a main
branch, locally -- but otherwise I think you'll run into problems when you use a branch other than main
if you don't already have it and maintain it locally.)
To create a _stable_ branch from the `main` one, e.g., `0.12.x`, run the following commands. | ||
|
||
```bash | ||
git checkout origin/main -b 0.12.x | ||
git checkout origin/main | ||
``` |
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.
Again, before checking out origin/main
you need to make sure that it is up to date with the origin
repo, either by doing a git remote update
or a git pull
.
And, when I check out the main
branch, I need to specify the local branch name:
git checkout origin/main -b main
otherwise, I end up with a "detached HEAD", and the attempt to push
my local main
branch won't push the changes that poetry
made (because they will be on my detached branch and not on main
, if it even exists).
docs/RELEASE.md
Outdated
git checkout origin/main | ||
git checkout -b 0.12.x |
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.
Assuming that you have a main
branch and a 0.12.0
branch (or, if there are no unique commits on it, the 0.12.0
"branch" could just be a tagged commit on the main
branch), if you then want to release 0.12.1
you have a choice: you can either add the pertinent commits on the 0.12.0
branch (creating a new branch if it was just a tag), or you can create a tag (0.12.1
) for the commit on main
which you want to release.
Life gets more interesting when you want to release 0.12.2
, but it boils down to the the same choices: you can add new commits to the 0.12.1
branch (creating it if necessary, if it is just a tag) or you can tag the existing commit that you want to release on whichever branch it is on (0.12.1
or main
).
There is nothing which requires you to create a branch in order to do a release, and there is nothing which demands that you release an update from an existing release branch. These choices are driven by the contents of the files and changes which comprise the release (and what the ancestry of those files' commits are).
But, the real point here is, instead of checking out/creating a branch, making no changes, and pushing it up, you can do that with a single push command, which is probably much simpler. E.g.,
git push origin origin/main:refs/heads/0.12.x
which creates the 0.12.x
branch on origin
using the contents of origin
's main
(assuming that your local tracking branch for origin/main
is up to date with the remote origin
).
Thanks @webbnh for all suggestions 🙏 For sure the release process needs to be improved and automated but I think that it is worth to expand on that front while doing it, i.e., as soon as we try releasing a new python package I will keep note of all the steps and then we can easily automate it or at least include a well-detailed process. |
Fixes #3
Changes proposed
nox
for multi environments tests automationCheck List (Check all the applicable boxes)