Do I lose my attack in Clash of clans war?

Solution 1:

No, as long as you don't place any units or spells you can either skip or exit the attack screen completely.

Solution 2:

I think since the last update you can not end the battle without loosing. I just did it to myself. I started the battle and realised I wanted to check the range of the dudes cc. I hit end and bam I got 0 out of 3 stars and now only have one attack left. I also watched the replay. 19 seconds of nothing. No troops or spells deployed.