Download, build, test and e-mail on single server

Here is what I want to achieve.

  1. download different 3rd-party libraries
  2. build a project

2.5. send an e-mail with the build log if the build fails

  1. perform different tests on said project

3.5. send an e-mail with test logs if a test fails

  1. upload the build if criteria met (specific tag on a specific branch and previous steps all succeed)

Additional condition: avoid unnecessary up- and downloading of files – there may be concurrent runners, but it’s a single server.

(Also, the build and test tasks are pretty straight-forward, no containers or clouds are involved.)

I’ve spent literal weeks on this already, trying to work around how cache works. It doesn’t work well with concurrent runners (and there are other issues as well).

I’m asking myself, what about the above process is so exotic it is such a pain to implement? Of course, I may be just stupid and don’t know something obvious (happened before).

Could someone please be so kind and show me how it’s done?