ballet.util.ci module

class ballet.util.ci.TravisPullRequestBuildDiffer(repo=None)[source]

Bases: ballet.util.git.PullRequestBuildDiffer

Differ from within Travis test environment

Requires several environment variables set by Travis to work properly:
  • TRAVIS_BUILD_DIR, to detect the git repo

  • TRAVIS_PULL_REQUEST, to determine whether the build is on a pull

    request

  • TRAVIS_COMMIT_RANGE, to determine which commits to diff.

Parameters

repo (Optional[Repo]) – repo object for the project

EXPECTED_TRAVIS_ENV_VARS = ('TRAVIS_BUILD_DIR', 'TRAVIS_PULL_REQUEST', 'TRAVIS_COMMIT_RANGE')
ballet.util.ci.can_use_travis_differ(repo)[source]

Check if the required travis env vars are set for the travis differ

Return type

bool

ballet.util.ci.dump_travis_env_vars()[source]
ballet.util.ci.ensure_expected_travis_env_vars(names)[source]
ballet.util.ci.get_travis_branch()[source]

Get current branch per Travis environment variables

If travis is building a PR, then TRAVIS_PULL_REQUEST is truthy and the name of the branch corresponding to the PR is stored in the TRAVIS_PULL_REQUEST_BRANCH environment variable. Else, the name of the branch is stored in the TRAVIS_BRANCH environment variable.

Return type

Optional[str]

ballet.util.ci.get_travis_env_or_fail(name)[source]
Return type

str

ballet.util.ci.get_travis_env_vars()[source]
Return type

Dict[str, str]

ballet.util.ci.get_travis_pr_num()[source]

Return the PR number if the job is a pull request, None otherwise

Return type

Optional[int]

Returns

int

ballet.util.ci.in_travis()[source]

Check if we are in Travis right now

Return type

bool

ballet.util.ci.is_travis_pr()[source]

Check if the current job is a pull request build

Return type

bool