I had two groups (of 3 and 4 students) present the same project back when I was teaching Digital Systems (VHDL similar to Verilog).
I could tell between who "paid for the pizza" and who could actually defend their own work but I wanted them to own up to it and be accountable for their dishonesty.
With a bit of chance, I told them to write the names of the people that worked on the project, 4 max. Those in the list will pass and those not in it would fail.
Left all 7 by themselves for an hour to deliberate. Those that didnāt work thought picking names at random would be just. Those that put in the effort wanted it to be based on merit.
Came back with a list of 3 names. Those passed. Based on merit.
Needless to say they werenāt āfriendsā anymore after that and I wasnāt the villain in their minds for āfailingā them.
I think they learned a valuable lesson, even those that passed.