Daniel Daniel - 16 days ago 6
Java Question

Java unit test: How to know its running on SemaphoreCI?

How is it possible to possible skip some of the tests on SemaphoreCI?
In other words, is it possible to know when we are running a specific test on Semaphore?

Answer

SemaphoreCI sets the CI environment variable to true.

For a complete list of SemaphoreCI's environment variables see Available Environment Variables

You could use this in your testing code or in your semaphore job's configuration commands to enable or disable specific maven profiles for example.