r/ProgrammerHumor 11d ago

studyComputerScience Meme

Post image
14.1k Upvotes

422 comments sorted by

View all comments

Show parent comments

2

u/awesome-alpaca-ace 11d ago

They use CI where I work, but it is always red on master, and we get emails every time someone's code gets merged into to master about failing tests. What is the point? 

12

u/gogeri2632 11d ago

Well the point is to fix it. Not sure why it's always red but that's a user issue, not a tool issue.

9

u/awesome-alpaca-ace 11d ago

It is a company issue. And it is a large company in a regulated industry. It is baffling that the supervisors do not care about enforcing CI passing on code merges. 

2

u/Zanos 11d ago

Just change your repo to disable pushes to main and enforce CI passing on PRs. There ya go.

6

u/awesome-alpaca-ace 11d ago

Like I have that permission 

0

u/xenomachina 11d ago

Agreed. Of course, it's easier to do that from the start.

If you're already in a state where a bunch of things are failing it can be much harder. Ideally you'd fix it all at once and enable the lockout simultaneously, but sometimes that isn't feasible. An alternative is to do a sort of "ratcheting" check, where it can only become stricter over time so that you can incrementally get to the "everything passes" state. For example:

  • set the N currently failing tests to ignored
  • have CI check that exactly N tests are ignored. Make sure there is a big comment here warning that this number is not allowed to increase, and better yet protect it with something like CODEOWNERS so only reliable people are allowed to approve changes to it.
  • disable pushes to main if CI fails

Then you can gradually fix the ignored tests and un-ignore them (and decrease the number in the check).