Skip to content

Commit

Permalink
chore(python): skip docfx in main presubmit (#889)
Browse files Browse the repository at this point in the history
* chore(python): skip docfx in main presubmit

* fix: properly template the repo name
  • Loading branch information
busunkim96 authored Jan 8, 2021
1 parent 67f09bf commit fb53b6f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
16 changes: 10 additions & 6 deletions synthtool/gcp/templates/python_library/.kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

set -eo pipefail

cd github/{{ metadata['repo']['repo'].split('/')[1] }}
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/{{ metadata['repo']['repo'].split('/')[1] }}"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
Expand All @@ -30,16 +34,16 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
python3 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
python3 -m nox -s ${NOX_SESSION:-}
else
python3.6 -m nox
python3 -m nox
fi
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/build.sh"
}
# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/python_library/.trampolinerc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
required_envvars+=(
"STAGING_BUCKET"
"V2_STAGING_BUCKET"
"NOX_SESSION"
)

# Add env vars which are passed down into the container here.
pass_down_envvars+=(
"STAGING_BUCKET"
"V2_STAGING_BUCKET"
"NOX_SESSION"
)

# Prevent unintentional override on the default image.
Expand Down
11 changes: 11 additions & 0 deletions synthtool/gcp/templates/python_library/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ DEFAULT_PYTHON_VERSION="{{ default_python_version }}"
SYSTEM_TEST_PYTHON_VERSIONS=[{% for v in system_test_python_versions %}"{{v}}"{% if not loop.last %},{% endif %}{% endfor %}]
UNIT_TEST_PYTHON_VERSIONS=[{% for v in unit_test_python_versions %}"{{v}}"{% if not loop.last %},{% endif %}{% endfor %}]

# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
nox.options.sessions = [
"unit",
"system",
"cover",
"lint",
"lint_setup_py",
"blacken",
"docs",
]

@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters.
Expand Down

0 comments on commit fb53b6f

Please sign in to comment.