The evolution of star formation activity in galaxy groups