Replies: 14 comments 3 replies
-
Running the unit tests only on push would potentially mean that the merged version doesn't ever get tested. Except in the situation where the merge will be a fast-forward, they are running adding different code. For work in progress branches, potentially all three sets of tests need to be run. For merges, all three also need to be run. I'm not sure how to reduce the runs, or if it's even worth doing. |
Beta Was this translation helpful? Give feedback.
-
In many projects the preferred git workflow is for everyone to fork the main repository, then clone their fork to their local computer, submitting PRs to the main repository from a feature branch on their fork. (see https://numpy.org/doc/stable/dev/index.html#devindex). |
Beta Was this translation helpful? Give feedback.
-
@andyfaff does the fork style make it harder to collaborate on PRs? Can I easily switch my local repo to your fork:branch, do some changes, then push back to it? Or do I have to fork your fork and do a PR on your repo to share code with you? |
Beta Was this translation helpful? Give feedback.
-
Looking back through the project's history for the last few years, the number of branches with more than one author is vanishingly small. But yes, github has the ability to control access to individual branches on other forks. On every PR, there's a nice little tickbox that says "Allow edits and access to secrets by maintainers" with the help text "If checked, users with write access to SasView/sasview can add new commits to your «branch name» branch." Or another way of putting it: of the several dozen different projects I contribute too, SasView is the only one using git like it is subversion. Lots of branches within the one project mostly works... but it does mean that things don't get polished up prior to being made public (meaning that the git history is much messier and therefore harder to bisect if needed). There's also 337 stale remote branches here, 320 of which need not exist. |
Beta Was this translation helpful? Give feedback.
-
Let's say A and B have both forked a repository, and have then cloned their fork to their local computer. This means that their 'origin' is their own fork:
This saves accidental Now let's say B creates a local feature branch and pushes it to their fork on github. B then submits a PR against the sasview repository from their fork. A wants to contribute to the changes that B is making in their feature branch. A is also a maintainer to the sasview project. A has two ways of doing this, but they both involve a common first step. A adds a remote to B's repository:
A then has the same state as B's feature_branch on their local computer.
Either way B's feature_branch PR against the sasview repository is then updated with the changes A made. Let's consider how CI runs as well. On many projects the CI configurations are often setup to only trigger if it's the main |
Beta Was this translation helpful? Give feedback.
-
Also, the 'everyone fork' approach has to be taken anyway by those who aren't part of the sasview maintainer team because they have to push their branches to their fork as they don't have permissions to push directly to sasview. |
Beta Was this translation helpful? Give feedback.
-
@andyfaff What you consider a problem I consider a feature. I like working together on a branch to solve problems. It is much more efficient than working through code reviews. Also, git+vscode makes it easy to switch context between branches. I don't have a convenient workflow for separate forks. Re: CI, I want to see tests passing/failing on the PR regardless of whether it is on sasview or on a fork, and whenever main is modified. There's no value running it on a branch that isn't in a PR since the result isn't reported anywhere. That is, I don't see the overall CI workload changing in the branch vs fork model if the CI is setup to do only what it needs to do. @llimeht I don't understand why fork vs. branch will have any effect on git history. You are going to have the separate block chains for the different commit paths unless you are doing squash merges with rebase, and you can do that just as easily with branches as with forks. Yes, cleaning up branches on merge would be useful. There's even a button for it on the PR page. |
Beta Was this translation helpful? Give feedback.
-
Agreed. That is currently the case and it should remain so. The CI status of every PR is shown within the PR regardless of the origin of the PR.
That's not correct. The CI outcome of every push is visible in the branch's history and in the 'Actions' tab. The details of the CI run can be inspected to look at the failures, artifacts downloaded etc. Yes, I run the tests locally, but I've also got the CI coverage across different platforms that I have no access to, and different versions of dependencies. That's how I know that the CI will pass before I open a PR — I treat the PR as "here is a request to review because I think it's ready to merge", not "it's ready for review, oh CI doesn't pass, oops, let me now start adding fixup commits, I wonder if this fixes it, no, oops, sorry for the noise, how about now, looks good, now you can review".
I wouldn't advocate for squashing all commits in the branch during the merge process. Some like that idea but I'm not a big fan. That doesn't make the history simpler as there is the same number of parallel branches in it, and in any large piece of work, having the work lumped into one big chunk makes both understanding it and bisecting it harder. It makes some sense if there's one main commit and then a trail of fixups behind it, but I'd rather that weren't turned into a PR in the first place. However, the author of a branch rebasing it onto the current When I'm working in my own fork and it's not a branch that I have 'published' (as in, I've not asked other people to work on it with me and not made a PR using it), I will freely rebase that branch. That's why any merges you see from me are normally on what look like short-lived branches and there are no fixup commits in them. I can only do that if I'm not going to ruin someone's day by rewriting the history of the branch; temporary branches in my own fork I can do that to but it would be poor practice to do that to branches in the shared project. |
Beta Was this translation helpful? Give feedback.
-
Back to the ticket:
Looking at the docs we should should ignore most The merge action isn't even listed in the We shouldn't need to run tests on the The git fork vs. branch workflow doesn't seem relevant to the issue. |
Beta Was this translation helpful? Give feedback.
-
Note: the git fork vs. branch workflow discussion does not belong here. Feel free to delete all my comments on the matter from this ticket, including this comment. |
Beta Was this translation helpful? Give feedback.
-
Was just thinking today that maybe this should be moved to discussions rather than be an issue at this point? |
Beta Was this translation helpful? Give feedback.
-
@lucas-wilkins I cleaned the off-topic bits out of #2307. Can you please unlock it so that we can resume discussion of the actual ticket? |
Beta Was this translation helpful? Give feedback.
-
For the purposes of discussion, the more important workflow change to consider is actually "merge main into feature branch" vs "rebase feature branch onto current main". The upside of rebasing is that the history is much simpler, bisecting is easier, fixups can be squashed so that history is not full of breakage+unbreakage, unittests that are run locally or on the branch on push are more reflective of the merged situation. The downside is that rewriting history is not a nice thing to do to a public branch, only something that you'd generally do to branches that no-one else has checked out. To an extent this is like asking "vi or emacs" and there is no right answer. However, having done git bisects on this code base in the past and having had them take hours longer than they needed to because of the convoluted and broken history, I can attest that there are also practical considerations. Some related reading: |
Beta Was this translation helpful? Give feedback.
-
Posted by @butlerpd in #2370 (comment)
For more details see that thread. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
All CI tests, installers, and doc builds are running twice on commits to branches once a PR is created. Simple origin, most of our GH actions scripts use a trigger of
[push,pull_request]
I propose that we run tests on
[push]
, installers on[pull_request]
and docs probably also on[push]
.To Reproduce
PR commits have 24 run tests instead of the proper 10.
Expected behavior
Tests should not be duplicated.
Beta Was this translation helpful? Give feedback.
All reactions