Global stability analysis for scalar-tensor models