-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Moving Travis helpers out of run_pylint into shared module. #2481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Copyright 2016 Google Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Common helpers for testing scripts.""" | ||
|
|
||
| import os | ||
|
|
||
|
|
||
| LOCAL_REMOTE_ENV = 'GOOGLE_CLOUD_TESTING_REMOTE' | ||
| LOCAL_BRANCH_ENV = 'GOOGLE_CLOUD_TESTING_BRANCH' | ||
| IN_TRAVIS_ENV = 'TRAVIS' | ||
| TRAVIS_PR_ENV = 'TRAVIS_PULL_REQUEST' | ||
| TRAVIS_BRANCH_ENV = 'TRAVIS_BRANCH' | ||
|
|
||
|
|
||
| def in_travis(): | ||
| """Detect if we are running in Travis. | ||
|
|
||
| .. _Travis env docs: https://docs.travis-ci.com/user/\ | ||
| environment-variables\ | ||
| #Default-Environment-Variables | ||
|
|
||
| See `Travis env docs`_. | ||
|
|
||
| :rtype: bool | ||
| :returns: Flag indicating if we are running on Travis. | ||
| """ | ||
| return os.getenv(IN_TRAVIS_ENV) == 'true' | ||
|
|
||
|
|
||
| def in_travis_pr(): | ||
| """Detect if we are running in a pull request on Travis. | ||
|
|
||
| .. _Travis env docs: https://docs.travis-ci.com/user/\ | ||
| environment-variables\ | ||
| #Default-Environment-Variables | ||
|
|
||
| See `Travis env docs`_. | ||
|
|
||
| .. note:: | ||
|
|
||
| This assumes we already know we are running in Travis. | ||
|
|
||
| :rtype: bool | ||
| :returns: Flag indicating if we are in a pull request on Travis. | ||
| """ | ||
| # NOTE: We're a little extra cautious and make sure that the | ||
| # PR environment variable is an integer. | ||
| try: | ||
| int(os.getenv(TRAVIS_PR_ENV, '')) | ||
| return True | ||
| except ValueError: | ||
| return False | ||
|
|
||
|
|
||
| def travis_branch(): | ||
| """Get the current branch of the PR. | ||
|
|
||
| .. _Travis env docs: https://docs.travis-ci.com/user/\ | ||
| environment-variables\ | ||
| #Default-Environment-Variables | ||
|
|
||
| See `Travis env docs`_. | ||
|
|
||
| .. note:: | ||
|
|
||
| This assumes we already know we are running in Travis | ||
| during a PR. | ||
|
|
||
| :rtype: str | ||
| :returns: The name of the branch the current pull request is | ||
| changed against. | ||
| """ | ||
| return os.getenv(TRAVIS_BRANCH_ENV) | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export GOOGLE_APPLICATION_CREDENTIALS="app_credentials.json.sample" | ||
| export GOOGLE_CLOUD_REMOTE_FOR_LINT="upstream" | ||
| export GOOGLE_CLOUD_BRANCH_FOR_LINT="master" | ||
| export GOOGLE_CLOUD_TESTING_REMOTE="upstream" | ||
| export GOOGLE_CLOUD_TESTING_BRANCH="master" | ||
| export GOOGLE_CLOUD_TESTS_API_KEY="abcd1234" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.