Last active
September 18, 2018 01:43
-
-
Save guruguruman/ce46105883d29c448ac1a9adf4a977d1 to your computer and use it in GitHub Desktop.
Determining TravisCI enviroment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TravisCI { | |
/* | |
* check whether test is running on TravisCI or not using TravisCI enviroment variables. | |
* | |
* as for TravisCI enviroment variables availables @see https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables | |
* | |
*/ | |
static var isRunningOnTravisEnviroment: Bool { | |
let isTravisEnviromentVariableName = "CI" | |
let isCIEnviromentVariableName = "TRAVIS" | |
let enviromentVariables = ProcessInfo().environment | |
if | |
enviromentVariables.keys.contains(isCIEnviromentVariableName), enviromentVariables[isCIEnviromentVariableName] == "true", | |
enviromentVariables.keys.contains(isTravisEnviromentVariableName), enviromentVariables[isCIEnviromentVariableName] == "true" { | |
return true | |
} | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment