Depends on which cruise line. If you go with Thomson, they have usually one formal night per week. Even then, there is the Lido for informal dining if you prefer. Royal Caribbean is similar (Windjammer for informal dining). Take something warm for daytime, as it can get cool even in summer.
Evening dress (which can often be hired for delivery/collection onboard) or lounge suit for 2 or 3 formal dinner nights; smart casual rest of time is generally acceptable. We went last June and needed only lighht weater (and light anorak in case of rain) during days; evenings outside can be cool. Forget shorts and vests.