Cruz did the only thing he could do without guaranteeing Republican defeat and his own demise. His supporters are principled conservatives. Had he fully endorsed Trump, they would have rejected him, and it would have done nothing to move them into the Trump camp.
By making a strong case for return to constitutional governance and conservative principles, saying Hillary must be defeated, saying there is no substitute for victory, and then saying "vote your conscience", he wasn't failing to endorse Trump as much as he was signaling to his supporters what their choice really is. By not alienating them with an outright endorsement, he made it OK for them to choose Trump in the end, and kept his own coalition together in the process. I think it was pretty brilliant, actually.