Ok, so this might sound a bit weird but here it goes.
I am teaching a data structures and algorithms lab at my local university and want to give my students a every fluid and fun experience. Up until now, I used a simple git repository which every student forked, and whenever they completed an assignment, they made a push + pull request, I would review their code and if everything was OK, I would merge the pull request into the main repo. This works pretty well, but I want to do something more interesting.
The lab is being taught in C (not even C++) (and no, I don't want to enter any polemics on why another language would be better). What I want to do is have something like a Jenkins build run on every push a pupil makes which verifies some predefined tests for the task at hand.
For example, for week 2, I would give them a homework assignment with lists. I would like to write the tests for this homework myself and then automatically verify what they did using those tests.
What I have available:
++ a very nice 'add-on' to all this would be to use something like sonar as a code verifier AND check for duplicated code within their branches (as to see if anyone copied an answer from someone else)
Am I on the right track by going for a Jenkins server, thinking about sonar etc? Am I way off? I don't think this is impossible. It might be difficult, yes, but that makes it fun ^^
The 'flow' that I want is:
On behalf of my dear students, thank you.
TL;DR: yes, what you want to do it feasible, and you're already looking at the correct tools.
What you want seems totally feasible: install the Git plugin for Jenkins, configure it to track each branches of the repo, and it's already possible to launch a build after each push.
Since you can execute arbitrary scripts during a Jenkins build, you can give push permissions to the Jenkins user, and have it merge and push the code if all tests pass.
You can then also install a sonar server, and call it through the Sonar plugin, and your students will get this additional feedback.
On the other hand, Gerrit might be a little overkill for what you're looking for. Or rather: it's a valuable tool, but I believe you don't need it for the first iteration.
I can think of two types of difficulties:
For (1), I mean that you'll need to implement your rules (for example "only build the subfolder which belong to the last commiter" ; "don't build merge commits on master" ; ...). And you'll likely run into issues such that:
I guess you'll just need to fix those glitches as you'll discover them. Just think about creating backups of your Jenkins config (you might as well store them in an ad hoc git repo).
For (2), I mean that you might want to take into account, for example, the case where a student would delete from the repo the tests his implementation can't pass. Or the case of the student who would directly push on master.
I believe you could add lot of checks to prevent this kind of cheating, however, rather than entering into a "technological conflict", I guess it would be more healthy to just tell them you trust them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With