Bu Sun Kim | e72202e | 2020-02-19 17:58:47 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Copyright 2018 Google LLC |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | set -eo pipefail |
| 17 | |
Yoshi Automation Bot | 84cfb97 | 2021-01-15 11:07:01 -0800 | [diff] [blame] | 18 | if [[ -z "${PROJECT_ROOT:-}" ]]; then |
| 19 | PROJECT_ROOT="github/python-api-core" |
| 20 | fi |
| 21 | |
| 22 | cd "${PROJECT_ROOT}" |
Bu Sun Kim | e72202e | 2020-02-19 17:58:47 -0800 | [diff] [blame] | 23 | |
| 24 | # Disable buffering, so that the logs stream through. |
| 25 | export PYTHONUNBUFFERED=1 |
| 26 | |
| 27 | # Debug: show build environment |
| 28 | env | grep KOKORO |
| 29 | |
| 30 | # Setup service account credentials. |
| 31 | export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json |
| 32 | |
| 33 | # Setup project id. |
| 34 | export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json") |
| 35 | |
| 36 | # Remove old nox |
Yoshi Automation Bot | 84cfb97 | 2021-01-15 11:07:01 -0800 | [diff] [blame] | 37 | python3 -m pip uninstall --yes --quiet nox-automation |
Bu Sun Kim | e72202e | 2020-02-19 17:58:47 -0800 | [diff] [blame] | 38 | |
| 39 | # Install nox |
Yoshi Automation Bot | 84cfb97 | 2021-01-15 11:07:01 -0800 | [diff] [blame] | 40 | python3 -m pip install --upgrade --quiet nox |
| 41 | python3 -m nox --version |
Bu Sun Kim | e72202e | 2020-02-19 17:58:47 -0800 | [diff] [blame] | 42 | |
Tres Seaver | 000d0a0 | 2020-10-06 15:47:28 -0400 | [diff] [blame] | 43 | # If NOX_SESSION is set, it only runs the specified session, |
| 44 | # otherwise run all the sessions. |
| 45 | if [[ -n "${NOX_SESSION:-}" ]]; then |
Yoshi Automation Bot | 84cfb97 | 2021-01-15 11:07:01 -0800 | [diff] [blame] | 46 | python3 -m nox -s ${NOX_SESSION:-} |
Tres Seaver | 000d0a0 | 2020-10-06 15:47:28 -0400 | [diff] [blame] | 47 | else |
Yoshi Automation Bot | 84cfb97 | 2021-01-15 11:07:01 -0800 | [diff] [blame] | 48 | python3 -m nox |
Tres Seaver | 000d0a0 | 2020-10-06 15:47:28 -0400 | [diff] [blame] | 49 | fi |