Skip to content

Commit b688765

Browse files
chore: Adding header-checker-lint and updating environment (#73)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore(python): skip docfx in main presubmit * chore(python): skip docfx in main presubmit * fix: properly template the repo name Source-Author: Bu Sun Kim <[email protected]> Source-Date: Fri Jan 8 10:32:13 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: fb53b6fb373b7c3edf4e55f3e8036bc6d73fa483 Source-Link: googleapis/synthtool@fb53b6f * chore: add missing quotation mark Source-Author: Bu Sun Kim <[email protected]> Source-Date: Mon Jan 11 09:43:06 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: 16ec872dd898d7de6e1822badfac32484b5d9031 Source-Link: googleapis/synthtool@16ec872 * chore: add 3.9 to noxfile template Since the python-docs-samples noxfile-template doesn't sync with this, I wanted to make sure the noxfile template matched the most recent change [here](https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4968/files) cc @tmatsuo Source-Author: Leah E. Cole <[email protected]> Source-Date: Fri Jan 15 17:24:05 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 56ddc68f36b32341e9f22c2c59b4ce6aa3ba635f Source-Link: googleapis/synthtool@56ddc68 * build(python): make `NOX_SESSION` optional I added this accidentally in #889. `NOX_SESSION` should be passed down if it is set but not marked required. Source-Author: Bu Sun Kim <[email protected]> Source-Date: Tue Jan 19 09:38:04 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: ba960d730416fe05c50547e975ce79fcee52c671 Source-Link: googleapis/synthtool@ba960d7 * chore: Add header checker config to python library synth Now that we have it working in [python-docs-samples](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/header-checker-lint.yml) we should consider adding it to the 🐍 libraries :) Source-Author: Leah E. Cole <[email protected]> Source-Date: Mon Jan 25 13:24:08 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 573f7655311b553a937f9123bee17bf78497db95 Source-Link: googleapis/synthtool@573f765 * chore: add noxfile parameters for extra dependencies Also, add tests for some noxfile parameters for assurance that the template generates valid Python. Co-authored-by: Jeffrey Rennie <[email protected]> Source-Author: Tim Swast <[email protected]> Source-Date: Tue Jan 26 12:26:57 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 778d8beae28d6d87eb01fdc839a4b4d966ed2ebe Source-Link: googleapis/synthtool@778d8be
1 parent 537b0f9 commit b688765

File tree

9 files changed

+58
-13
lines changed

9 files changed

+58
-13
lines changed

.github/header-checker-lint.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{"allowedCopyrightHolders": ["Google LLC"],
2+
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
3+
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
4+
"sourceFileExtensions": [
5+
"ts",
6+
"js",
7+
"java",
8+
"sh",
9+
"Dockerfile",
10+
"yaml",
11+
"py",
12+
"html",
13+
"txt"
14+
]
15+
}

.kokoro/build.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
set -eo pipefail
1717

18-
cd github/python-error-reporting
18+
if [[ -z "${PROJECT_ROOT:-}" ]]; then
19+
PROJECT_ROOT="github/python-error-reporting"
20+
fi
21+
22+
cd "${PROJECT_ROOT}"
1923

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

3236
# Remove old nox
33-
python3.6 -m pip uninstall --yes --quiet nox-automation
37+
python3 -m pip uninstall --yes --quiet nox-automation
3438

3539
# Install nox
36-
python3.6 -m pip install --upgrade --quiet nox
37-
python3.6 -m nox --version
40+
python3 -m pip install --upgrade --quiet nox
41+
python3 -m nox --version
3842

3943
# If NOX_SESSION is set, it only runs the specified session,
4044
# otherwise run all the sessions.
4145
if [[ -n "${NOX_SESSION:-}" ]]; then
42-
python3.6 -m nox -s "${NOX_SESSION:-}"
46+
python3 -m nox -s ${NOX_SESSION:-}
4347
else
44-
python3.6 -m nox
48+
python3 -m nox
4549
fi

.kokoro/docs/docs-presubmit.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ env_vars: {
1515
key: "TRAMPOLINE_IMAGE_UPLOAD"
1616
value: "false"
1717
}
18+
19+
env_vars: {
20+
key: "TRAMPOLINE_BUILD_FILE"
21+
value: "github/python-error-reporting/.kokoro/build.sh"
22+
}
23+
24+
# Only run this nox session.
25+
env_vars: {
26+
key: "NOX_SESSION"
27+
value: "docs docfx"
28+
}

.trampolinerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ required_envvars+=(
2424
pass_down_envvars+=(
2525
"STAGING_BUCKET"
2626
"V2_STAGING_BUCKET"
27+
"NOX_SESSION"
2728
)
2829

2930
# Prevent unintentional override on the default image.

google/cloud/errorreporting_v1beta1/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"ErrorEvent",
5252
"ErrorGroup",
5353
"ErrorGroupOrder",
54-
"ErrorGroupServiceClient",
5554
"ErrorGroupStats",
55+
"ErrorStatsServiceClient",
5656
"GetGroupRequest",
5757
"HttpRequestContext",
5858
"ListEventsRequest",
@@ -71,5 +71,5 @@
7171
"TimedCountAlignment",
7272
"TrackingIssue",
7373
"UpdateGroupRequest",
74-
"ErrorStatsServiceClient",
74+
"ErrorGroupServiceClient",
7575
)

noxfile.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
3131
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
3232

33+
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
34+
nox.options.sessions = [
35+
"unit",
36+
"system",
37+
"cover",
38+
"lint",
39+
"lint_setup_py",
40+
"blacken",
41+
"docs",
42+
]
43+
3344

3445
@nox.session(python=DEFAULT_PYTHON_VERSION)
3546
def lint(session):
@@ -75,6 +86,7 @@ def default(session):
7586
session.install(
7687
"mock", "pytest", "pytest-cov",
7788
)
89+
7890
session.install("-e", ".")
7991

8092
# Run py.test against the unit tests.
@@ -126,6 +138,7 @@ def system(session):
126138
"mock", "pytest", "google-cloud-testutils",
127139
)
128140
session.install("-e", "test_utils")
141+
129142
session.install("-e", ".")
130143

131144
# Run py.test against the system tests.

samples/snippets/api/noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8585

8686
# DO NOT EDIT - automatically generated.
8787
# All versions used to tested samples.
88-
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]
88+
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
8989

9090
# Any default versions that should be ignored.
9191
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']

samples/snippets/fluent_on_compute/noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8585

8686
# DO NOT EDIT - automatically generated.
8787
# All versions used to tested samples.
88-
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]
88+
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
8989

9090
# Any default versions that should be ignored.
9191
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']

synth.metadata

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-error-reporting.git",
7-
"sha": "33f28b6eb1ec823c24023d316255ff9b06e415d0"
7+
"sha": "511be86d97804b6ae4bee0718dde5fde21bddb49"
88
}
99
},
1010
{
@@ -19,14 +19,14 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "41a4e56982620d3edcf110d76f4fcdfdec471ac8"
22+
"sha": "778d8beae28d6d87eb01fdc839a4b4d966ed2ebe"
2323
}
2424
},
2525
{
2626
"git": {
2727
"name": "synthtool",
2828
"remote": "https://github.com/googleapis/synthtool.git",
29-
"sha": "41a4e56982620d3edcf110d76f4fcdfdec471ac8"
29+
"sha": "778d8beae28d6d87eb01fdc839a4b4d966ed2ebe"
3030
}
3131
}
3232
],
@@ -48,6 +48,7 @@
4848
".github/ISSUE_TEMPLATE/feature_request.md",
4949
".github/ISSUE_TEMPLATE/support_request.md",
5050
".github/PULL_REQUEST_TEMPLATE.md",
51+
".github/header-checker-lint.yml",
5152
".github/release-please.yml",
5253
".github/snippet-bot.yml",
5354
".gitignore",

0 commit comments

Comments
 (0)