One way is to use the CI Pipeline feature of GitLab. When you commit your code, run it though a build stage (if necessary) and then a test stage. Any tests that output an error will cause the test stage of the CI Pipeline to fail.
I set up a simple proof of concept [1]. My goal is to complete the "Your First RPM Package" tutorial [2] using Web IDE from a iPad 6th Gen. [3] is the resulting CI Pipeline. I recognize this is nowhere near a "real" project (and hadn't ever planned to really share or use it). Maybe someone else has a more complete example?
Edit: Since you mentioned Java development, it might be worth reading through the answers to the Stack Overflow question "How to use GitLab CI to build a Java Maven project?" [4].
I set up a simple proof of concept [1]. My goal is to complete the "Your First RPM Package" tutorial [2] using Web IDE from a iPad 6th Gen. [3] is the resulting CI Pipeline. I recognize this is nowhere near a "real" project (and hadn't ever planned to really share or use it). Maybe someone else has a more complete example?
Edit: Since you mentioned Java development, it might be worth reading through the answers to the Stack Overflow question "How to use GitLab CI to build a Java Maven project?" [4].
[1]: https://gitlab.com/mchogan/iPad-experiment/tree/mchogan-mast...
[2]: https://rpm-packaging-guide.github.io/#hello-world "Your First RPM Package"
[3]: https://gitlab.com/mchogan/iPad-experiment/pipelines/2277793...
[4]: https://stackoverflow.com/q/33430487/3877908 "How to use GitLab CI to build a Java Maven project?"