Asian markets have risen as European leaders said they had agreed a debt deal to keep Greece in the eurozone, while Shanghai advanced for a third straight session.