diff --git a/ci/ci.go b/ci/ci.go index f2d8e76..a316d5a 100644 --- a/ci/ci.go +++ b/ci/ci.go @@ -5,8 +5,6 @@ package ci import ( "os" - - travis "github.com/libp2p/go-libp2p-testing/ci/travis" ) // EnvVar is a type to use travis-only env var names with @@ -20,14 +18,9 @@ const ( VarVerbose EnvVar = "TEST_VERBOSE" ) -// IsRunning attempts to determine whether this process is -// running on CI. This is done by checking any of: -// -// CI=true -// travis.IsRunning() -// +// IsRunning attempts to determine whether this process is running on CI. func IsRunning() bool { - return os.Getenv(string(VarCI)) == "true" || travis.IsRunning() + return os.Getenv(string(VarCI)) == "true" } // Env returns the value of a CI env variable. diff --git a/ci/travis/travis.go b/ci/travis/travis.go deleted file mode 100644 index e22fb90..0000000 --- a/ci/travis/travis.go +++ /dev/null @@ -1,57 +0,0 @@ -// Package travis implements some helper functions to use during -// tests. Many times certain facilities are not available, or tests -// must run differently. -package travis - -import "os" - -// EnvVar is a type to use travis-only env var names with -// the type system. -type EnvVar string - -// Environment variables that TravisCI uses. -const ( - VarCI EnvVar = "CI" - VarTravis EnvVar = "TRAVIS" - VarBranch EnvVar = "TRAVIS_BRANCH" - VarBuildDir EnvVar = "TRAVIS_BUILD_DIR" - VarBuildId EnvVar = "TRAVIS_BUILD_ID" - VarBuildNumber EnvVar = "TRAVIS_BUILD_NUMBER" - VarCommit EnvVar = "TRAVIS_COMMIT" - VarCommitRange EnvVar = "TRAVIS_COMMIT_RANGE" - VarJobId EnvVar = "TRAVIS_JOB_ID" - VarJobNumber EnvVar = "TRAVIS_JOB_NUMBER" - VarPullRequest EnvVar = "TRAVIS_PULL_REQUEST" - VarSecureEnvVars EnvVar = "TRAVIS_SECURE_ENV_VARS" - VarRepoSlug EnvVar = "TRAVIS_REPO_SLUG" - VarOsName EnvVar = "TRAVIS_OS_NAME" - VarTag EnvVar = "TRAVIS_TAG" - VarGoVersion EnvVar = "TRAVIS_GO_VERSION" -) - -// IsRunning attempts to determine whether this process is -// running on Travis-CI. This is done by checking ALL of the -// following env vars are set: -// -// CI=true -// TRAVIS=true -// -// NOTE: cannot just check CI. -func IsRunning() bool { - return Env(VarCI) == "true" && Env(VarTravis) == "true" -} - -// Env returns the value of a travis env variable. -func Env(v EnvVar) string { - return os.Getenv(string(v)) -} - -// JobId returns the travis JOB_ID of this build. -func JobId() string { - return Env(VarJobId) -} - -// JobNumber returns the travis JOB_NUMBER of this build. -func JobNumber() string { - return Env(VarJobNumber) -} diff --git a/ci/travis/travis_test.go b/ci/travis/travis_test.go deleted file mode 100644 index f7b9259..0000000 --- a/ci/travis/travis_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package travis - -import ( - "os" - "testing" -) - -func TestIsRunning(t *testing.T) { - tr := os.Getenv("TRAVIS") == "true" && os.Getenv("CI") == "true" - if tr != IsRunning() { - t.Error("IsRunning() does not match TRAVIS && CI env var check") - } -}