From experience, I can tell you what <i>not</i> to do: Don't look at HN. It's much too easy to get lost in some captivating thread and spend much more time there than you intended. The same is true of news sites or financial sites or social media.<p>Checking work-related e-mail (or other work-related messaging media) is a possibility. At least if you end up spending more time there than you intended, it's something that you probably needed to eventually do for your job anyway. The risk is that you'll spend too much time on that and will have lost your state of flow for your programming task by the time your build is done.<p>One possibility would be to think about what the next steps are that you'd need to do when the build is done. Any new tests you need to write? What would you do if the current build doesn't actually fix the bug you thought you fixed? Can your code be refactored to make it better? Etc.
Work on other branches or projects. Go to the restroom. Have a coffee.<p>If working from home do some housecleaning. Wash dishes. Shave. Prepare food for lunch or dinner. Etc.