Add github actions - #145
Conversation
| @@ -0,0 +1,38 @@ | |||
| name: Tests | |||
|
|
|||
| on: [push] | |||
There was a problem hiding this comment.
should this be on: [push, merge_requests] ?
There was a problem hiding this comment.
I'm not really sure, but in my experience adding both will result in the tests running twice, as you can see on a test PR I made here (tests failing can be ignored, just for demonstrating).

There was a problem hiding this comment.
that is correct. by using the merge request option it runs one set of actions on the branch and one more set of actions on the potential merge commit that would be originated if the merge request is merged.
the last part is important for the case in which your local branch is not up to date with the latest main/master branch.
this is the user case:
- you create a new branch starting from
main, you start adding commits there, and the build is green - in the mean time someone adds a bunch of commits to
main(as example making other merge requests or pushing directly to the branch) and the build is also green, but the changes are not compatible with the changes you did in your branch (even if there are no git conflicts) - at this point both branches have a green build, but if you merge your branch, the resulting pipeline will be broken
with the merge request builds you reduce the possibility of failure. in reality the merge request approach does not give you the guarantee that the merged result will still be green. there are mainly two popular approaches to have the build always green.
- run the merge request actions after pressing the merge request button, and cancel the merge if the actions build fails
- enforce that the merge request branch is always in sync with the latest main branch
both this approaches have advantages and downsides, but is are one of the most common approaches to ensure a green build
No description provided.