GUI Agents with Foundation Models: A Comprehensive Survey