Helson sets in compact and locally compact groups