Skip to content

Commit 065730a

Browse files
committed
Uses pre-built wheels when pip installing from tox.
In addition: - Creates script scripts/update_wheels_project.sh to kick off a new build when merging to master (outside of a PR). - Moves update_docs into a larger group of merge scripts that happen when merging to master.
1 parent 87cf71d commit 065730a

File tree

7 files changed

+141
-24
lines changed

7 files changed

+141
-24
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ regression/local_test_setup
4848

4949
# Make sure a generated file isn't accidentally committed.
5050
pylintrc_reduced
51+
52+
# Wheel directory used in Travis builds.
53+
gcloud-python-wheels/

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
language: python
22

3+
before_install:
4+
- git clone https://github.com/GoogleCloudPlatform/gcloud-python-wheels
5+
gcloud-python-wheels
6+
- export WHEELHOUSE="$(pwd)/gcloud-python-wheels/wheelhouse/"
7+
38
install:
49
- scripts/custom_pip_install.sh tox
510

@@ -8,6 +13,7 @@ script:
813
- tox -e py27
914
- tox -e lint
1015
- tox -e regression
11-
- scripts/update_docs.sh
16+
- scripts/merge.sh
17+
1218
after_success:
1319
- tox -e coveralls

scripts/custom_pip_install.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
#!/bin/bash
2-
# Temporarily perform default pip install before initial
3-
# wheelhouse is built.
4-
pip install "$@"
2+
3+
# Copyright 2014 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
if [[ -d ${WHEELHOUSE} ]]; then
18+
pip install --no-index --find-links=${WHEELHOUSE} "$@"
19+
fi
20+
# Update if the locally cached wheels are out-of-date.
21+
pip install --upgrade "$@"

scripts/merge.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Copyright 2014 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ev
18+
19+
##############################################
20+
# Perform actions if we are updating master. #
21+
##############################################
22+
if [[ "${TRAVIS_BRANCH}" == "master" ]] && \
23+
[[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then
24+
scripts/update_docs.sh
25+
scripts/update_wheels_project.sh
26+
else
27+
echo "Not in master on a non-pull request. Doing nothing."
28+
fi

scripts/run_regression.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
#!/bin/bash
22

3+
# Copyright 2014 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
317
set -ev
418

519
# If we're on Travis, we need to set up the environment.
620
if [[ "${TRAVIS}" == "true" ]]; then
721
# If merging to master and not a pull request, run regression test.
8-
if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
22+
if [[ "${TRAVIS_BRANCH}" == "master" ]] && \
23+
[[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then
924
echo "Running in Travis during merge, decrypting stored key file."
1025

1126
# Convert encrypted key file into decrypted file to be used.

scripts/update_docs.sh

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,17 @@
1616

1717
set -ev
1818

19-
if [[ "${TRAVIS_BRANCH}" == "master" ]] && \
20-
[[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then
21-
# Build new docset in docs/_build from master.
22-
tox -e docs
23-
git submodule add -b gh-pages \
24-
"https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME}" \
25-
ghpages
26-
cp -R docs/_build/html/* ghpages/
27-
cd ghpages
28-
git add .
29-
# Commit to gh-pages branch to apply changes.
30-
git config user.name "selfiebot"
31-
git commit -m "Update docs after merge to master."
32-
git push \
33-
"https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME}" \
34-
HEAD:gh-pages
35-
else
36-
echo "Not in master on a non-pull request. Doing nothing."
37-
fi
19+
# Build new docset in docs/_build from master.
20+
tox -e docs
21+
git submodule add -b gh-pages \
22+
"https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME}" \
23+
ghpages
24+
cp -R docs/_build/html/* ghpages/
25+
cd ghpages
26+
git add .
27+
# Commit to gh-pages branch to apply changes.
28+
git config user.name "selfiebot"
29+
git commit -m "Update docs after merge to master."
30+
git push \
31+
"https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME}" \
32+
HEAD:gh-pages

scripts/update_wheels_project.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Copyright 2014 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ev
18+
19+
#########################################
20+
# Settings for specific wheels project. #
21+
#########################################
22+
WHEELS_PROJECT_NAME="gcloud-python-wheels"
23+
# "gcloud-python-wheels" is already used by .travis.yml
24+
FRESH_REPO_DIR="gcloud-python-wheels-fresh"
25+
26+
###################################
27+
# Checkout the wheels repository. #
28+
###################################
29+
git config --global user.email "travis@travis-ci.org"
30+
git config --global user.name "travis-ci"
31+
git clone --quiet --branch=master \
32+
"https://${GH_OAUTH_TOKEN}@github.com//${GH_OWNER}/${WHEELS_PROJECT_NAME}" \
33+
${FRESH_REPO_DIR}
34+
# NOTE: Assumes ${GH_OAUTH_TOKEN} and ${GH_OWNER} are set in Travis build
35+
# settings for project. This also assumes the wheels project is owned by
36+
# ${GH_OWNER} and that the token can be used to make commits.
37+
38+
#################################################
39+
# Add the current commit hash to a static file. #
40+
#################################################
41+
echo "${TRAVIS_COMMIT}" > ${FRESH_REPO_DIR}/LATEST_COMMIT
42+
43+
##############################################
44+
# Display git status and push LATEST_COMMIT. #
45+
##############################################
46+
cd ${FRESH_REPO_DIR}
47+
git add ${FRESH_REPO_DIR}/LATEST_COMMIT
48+
49+
git status
50+
# H/T: http://stackoverflow.com/a/13730477/1068170
51+
git commit -m "Latest wheels build by travis-ci. [ci skip]"
52+
git status
53+
git push origin master

0 commit comments

Comments
 (0)