-
Notifications
You must be signed in to change notification settings - Fork 321
chore: adds ci/cd related infra content #2258
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 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2344882
chore: adds ci/cd related infra content
chalmerlowe ddad528
updates branch for github CI/CD check to autogen
chalmerlowe 1af6db4
update run commands
chalmerlowe bc267ce
updates formatting in pagers.py files to pass blacken
chalmerlowe c656ee9
removes unused check
chalmerlowe af7b656
adds unittest.yml
chalmerlowe f926a08
adds removes matrix.options
chalmerlowe bcb3d5c
adds kokoro linting-typing.cfg
chalmerlowe 27ad7b7
mods kokoro linting-typing.cfg
chalmerlowe c362a5f
mods kokoro linting-typing.cfg again
chalmerlowe a22f3c6
adds kokoro .sh files
chalmerlowe d180c02
comments out a small snippet for debugging
chalmerlowe 29f1ab7
Update google/cloud/bigquery_v2/services/job_service/pagers.py
chalmerlowe f295759
Update .github/workflows/lint.yml
chalmerlowe 799cd64
removes sample code
chalmerlowe fbc2e13
removes two currently unused ci shell scripts
chalmerlowe 74991de
removes .kokoro files for now
chalmerlowe 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2025 Google LLC | ||
# | ||
# 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. | ||
docker: | ||
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest | ||
digest: sha256:3b3a31be60853477bc39ed8d9bac162cac3ba083724cecaad54eb81d4e4dae9c | ||
# created: 2025-04-16T22:40:03.123475241Z |
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,22 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# 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. | ||
|
||
docker: | ||
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest | ||
|
||
deep-remove-regex: | ||
- /owl-bot-staging | ||
|
||
begin-after-commit-hash: f2de93abafa306b2ebadf1d10d947db8bcf2bf15 | ||
|
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,11 @@ | ||
# Code owners file. | ||
# This file controls who is tagged for review for any given pull request. | ||
# | ||
# For syntax help see: | ||
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax | ||
|
||
# The @googleapis/api-bigquery is the default owner for changes in this repo | ||
* @googleapis/api-bigquery @googleapis/yoshi-python | ||
|
||
# The python-samples-reviewers team is the default owner for samples changes | ||
/samples/ @googleapis/api-bigquery @googleapis/python-samples-owners @googleapis/yoshi-python |
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,28 @@ | ||
# How to Contribute | ||
|
||
We'd love to accept your patches and contributions to this project. There are | ||
just a few small guidelines you need to follow. | ||
|
||
## Contributor License Agreement | ||
|
||
Contributions to this project must be accompanied by a Contributor License | ||
Agreement. You (or your employer) retain the copyright to your contribution; | ||
this simply gives us permission to use and redistribute your contributions as | ||
part of the project. Head over to <https://cla.developers.google.com/> to see | ||
your current agreements on file or to sign a new one. | ||
|
||
You generally only need to submit a CLA once, so if you've already submitted one | ||
(even if it was for a different project), you probably don't need to do it | ||
again. | ||
|
||
## Code reviews | ||
|
||
All submissions, including submissions by project members, require review. We | ||
use GitHub pull requests for this purpose. Consult | ||
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more | ||
information on using pull requests. | ||
|
||
## Community Guidelines | ||
|
||
This project follows [Google's Open Source Community | ||
Guidelines](https://opensource.google.com/conduct/). |
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,7 @@ | ||
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: | ||
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea | ||
- [ ] Ensure the tests and linter pass | ||
- [ ] Code coverage does not decrease (if any source code was changed) | ||
- [ ] Appropriate docs were updated (if necessary) | ||
|
||
Fixes #<issue_number_goes_here> 🦕 |
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,14 @@ | ||
releaseType: python | ||
handleGHRelease: true | ||
# NOTE: this section is generated by synthtool.languages.python | ||
# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py | ||
branches: | ||
- branch: v2 | ||
handleGHRelease: true | ||
releaseType: python | ||
- branch: v1 | ||
handleGHRelease: true | ||
releaseType: python | ||
- branch: v0 | ||
handleGHRelease: true | ||
releaseType: python |
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,2 @@ | ||
enabled: true | ||
multiScmName: python-bigquery |
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,40 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- autogen | ||
# Trigger workflow on GitHub merge queue events | ||
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group | ||
merge_group: | ||
types: [checks_requested] | ||
name: lint | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base` | ||
# See https://github.com/googleapis/google-cloud-python/issues/12013 | ||
# and https://github.com/actions/checkout#checkout-head. | ||
with: | ||
fetch-depth: 2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.13" | ||
- name: Install nox | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install nox | ||
- name: Run lint | ||
env: | ||
BUILD_TYPE: presubmit | ||
TEST_TYPE: lint | ||
# TODO(https://github.com/googleapis/google-cloud-python/issues/13775): Specify `PY_VERSION` rather than relying on the default python version of the nox session. | ||
PY_VERSION: "unused" | ||
run: | | ||
nox -s lint | ||
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,87 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- autogen | ||
# Trigger workflow on GitHub merge queue events | ||
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group | ||
merge_group: | ||
types: [checks_requested] | ||
name: unittest | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
unit: | ||
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed. | ||
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix | ||
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
python: ['3.9', '3.10', "3.11", "3.12", "3.13"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base` | ||
# See https://github.com/googleapis/google-cloud-python/issues/12013 | ||
# and https://github.com/actions/checkout#checkout-head. | ||
with: | ||
fetch-depth: 2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Install nox | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install nox | ||
- name: Run unit tests | ||
env: | ||
COVERAGE_FILE: .coverage-${{ matrix.python }} | ||
BUILD_TYPE: presubmit | ||
TEST_TYPE: unit | ||
PY_VERSION: ${{ matrix.python }} | ||
run: | | ||
nox -s unit-${{ matrix.python }} | ||
- name: Upload coverage results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-artifact-${{ '{{' }} matrix.python {{ '}}' }} | ||
path: .coverage-${{ matrix.python }} | ||
|
||
cover: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- unit | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base` | ||
# See https://github.com/googleapis/google-cloud-python/issues/12013 | ||
# and https://github.com/actions/checkout#checkout-head. | ||
with: | ||
fetch-depth: 2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Set number of files changes in packages directory | ||
id: packages | ||
run: echo "::set-output name=num_files_changed::$(git diff HEAD~1 -- packages | wc -l)" | ||
- name: Install coverage | ||
if: steps.packages.num_files_changed > 0 | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install coverage | ||
- name: Download coverage results | ||
if: ${{ steps.date.packages.num_files_changed > 0 }} | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: .coverage-results/ | ||
- name: Report coverage results | ||
if: ${{ steps.date.packages.num_files_changed > 0 }} | ||
run: | | ||
find .coverage-results -type f -name '*.zip' -exec unzip {} \; | ||
coverage combine .coverage-results/**/.coverage* | ||
coverage report --show-missing --fail-under=100 |
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,60 @@ | ||
#!/bin/bash | ||
# Copyright 2024 Google LLC | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
|
||
set -eo pipefail | ||
|
||
CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
||
if [[ -z "${PROJECT_ROOT:-}" ]]; then | ||
PROJECT_ROOT=$(realpath "${CURRENT_DIR}/..") | ||
fi | ||
|
||
pushd "${PROJECT_ROOT}" | ||
|
||
# Disable buffering, so that the logs stream through. | ||
export PYTHONUNBUFFERED=1 | ||
|
||
# Debug: show build environment | ||
env | grep KOKORO | ||
|
||
# Setup service account credentials. | ||
if [[ -f "${KOKORO_GFILE_DIR}/service-account.json" ]] | ||
then | ||
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json | ||
fi | ||
|
||
# Setup project id. | ||
if [[ -f "${KOKORO_GFILE_DIR}/project-id.json" ]] | ||
then | ||
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json") | ||
fi | ||
|
||
# If this is a continuous build, send the test log to the FlakyBot. | ||
# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot. | ||
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then | ||
cleanup() { | ||
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot | ||
$KOKORO_GFILE_DIR/linux_amd64/flakybot | ||
} | ||
trap cleanup EXIT HUP | ||
fi | ||
|
||
# If NOX_SESSION is set, it only runs the specified session, | ||
# otherwise run all the sessions. | ||
if [[ -n "${NOX_SESSION:-}" ]]; then | ||
python3 -m nox -s ${NOX_SESSION:-} | ||
else | ||
python3 -m nox | ||
fi |
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,43 @@ | ||
#!/bin/bash | ||
# Copyright 2024 Google LLC. | ||
# | ||
# 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. | ||
|
||
set -eo pipefail | ||
|
||
function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} | ||
function msg { println "$*" >&2 ;} | ||
function println { printf '%s\n' "$(now) $*" ;} | ||
|
||
|
||
# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: | ||
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com | ||
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" | ||
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" | ||
mkdir -p ${SECRET_LOCATION} | ||
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") | ||
do | ||
msg "Retrieving secret ${key}" | ||
docker run --entrypoint=gcloud \ | ||
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ | ||
gcr.io/google.com/cloudsdktool/cloud-sdk \ | ||
secrets versions access latest \ | ||
--project cloud-devrel-kokoro-resources \ | ||
--secret ${key} > \ | ||
"${SECRET_LOCATION}/${key}" | ||
if [[ $? == 0 ]]; then | ||
msg "Secret written to ${SECRET_LOCATION}/${key}" | ||
else | ||
msg "Error retrieving secret ${key}" | ||
fi | ||
done |
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,7 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Only run these nox sessions. | ||
env_vars: { | ||
key: "NOX_SESSION" | ||
value: "lint" | ||
} |
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,26 @@ | ||
#!/bin/bash | ||
# Copyright 2024 Google LLC | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
|
||
# A customized test runner for samples. | ||
# | ||
# For periodic builds, you can specify this file for testing against head. | ||
|
||
# `-e` enables the script to automatically fail when a command fails | ||
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero | ||
set -eo pipefail | ||
# Enables `**` to include files nested inside sub-folders | ||
shopt -s globstar | ||
|
||
exec .kokoro/test-samples-impl.sh |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.