Modeling stress and failure in shrinking coatings