I'm a fourth year student earning a degree in computer science. I have a fairly high gpa, completed two research projects, and have conducted myself honestly through my entire career. A few weeks ago, we received an assignment comprised of 3 sections. My class partner and I decided to work separately on a single module and then collaborate on the last section. After a few days, my partner brought it to my attention that he had found the entire assignment on Github. This bothered me, but I ultimately made the decision to not back out if he decided to plagiarize his section. After completing both of our sections(I did mine honestly) we began collaboration on the final part. At this point, I made the regrettable decision to mimic a significant portion of the other programs structure.
I feel incredibly guilty about this. If this were an individual project, I would fess up to the professor and accept whatever consequences. However, since my partner(who I also consider a friend) is graduating, and starting a well paying job in a nearby city, I feel obliged to hope for the best and see things through.
I do not consider myself to be an unethical person, but high levels of stress and a bad influence caused me to make a bad decision. This I realize is my own fault.
We have not yet received a grade for the assignment, but I'm expecting the worst. How should I proceed? If I do get caught, what will the consequences be? If I don't get caught, is there anything I can do to relieve myself of guilt without ruining my partners career?