Skip to content
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

Add github actions #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DanielGSoftware
Copy link
Contributor

No description provided.

@DanielGSoftware DanielGSoftware marked this pull request as draft February 10, 2022 13:32
@DanielGSoftware DanielGSoftware marked this pull request as ready for review February 10, 2022 14:00
@@ -0,0 +1,38 @@
name: Tests

on: [push]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be on: [push, merge_requests] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. you create a new branch starting from main, you start adding commits there, and the build is green
  2. 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)
  3. 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.

  1. run the merge request actions after pressing the merge request button, and cancel the merge if the actions build fails
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants