A very luminous magnetar-powered supernova associated with an ultra-long γ-ray burst