Skip to content

Commit 0e9abc0

Browse files
committed
chore: adds ci/cd related infra content (#2258)
* chore: adds ci/cd related infra content * updates branch for github CI/CD check to autogen * update run commands * updates formatting in pagers.py files to pass blacken * removes unused check * adds unittest.yml * adds removes matrix.options * adds kokoro linting-typing.cfg * mods kokoro linting-typing.cfg * mods kokoro linting-typing.cfg again * adds kokoro .sh files * comments out a small snippet for debugging * Update google/cloud/bigquery_v2/services/job_service/pagers.py * Update .github/workflows/lint.yml * removes sample code * removes two currently unused ci shell scripts * removes .kokoro files for now
1 parent b736b23 commit 0e9abc0

File tree

15 files changed

+228
-25
lines changed

15 files changed

+228
-25
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
docker:
15+
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16+
digest: sha256:3b3a31be60853477bc39ed8d9bac162cac3ba083724cecaad54eb81d4e4dae9c
17+
# created: 2025-04-16T22:40:03.123475241Z

.github/.OwlBot.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
docker:
16+
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
17+
18+
deep-remove-regex:
19+
- /owl-bot-staging
20+
21+
begin-after-commit-hash: f2de93abafa306b2ebadf1d10d947db8bcf2bf15
22+

.github/CODEOWNERS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Code owners file.
2+
# This file controls who is tagged for review for any given pull request.
3+
#
4+
# For syntax help see:
5+
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
6+
7+
# The @googleapis/api-bigquery is the default owner for changes in this repo
8+
* @googleapis/api-bigquery @googleapis/yoshi-python
9+
10+
# The python-samples-reviewers team is the default owner for samples changes
11+
/samples/ @googleapis/api-bigquery @googleapis/python-samples-owners @googleapis/yoshi-python

.github/CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to Contribute
2+
3+
We'd love to accept your patches and contributions to this project. There are
4+
just a few small guidelines you need to follow.
5+
6+
## Contributor License Agreement
7+
8+
Contributions to this project must be accompanied by a Contributor License
9+
Agreement. You (or your employer) retain the copyright to your contribution;
10+
this simply gives us permission to use and redistribute your contributions as
11+
part of the project. Head over to <https://cla.developers.google.com/> to see
12+
your current agreements on file or to sign a new one.
13+
14+
You generally only need to submit a CLA once, so if you've already submitted one
15+
(even if it was for a different project), you probably don't need to do it
16+
again.
17+
18+
## Code reviews
19+
20+
All submissions, including submissions by project members, require review. We
21+
use GitHub pull requests for this purpose. Consult
22+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23+
information on using pull requests.
24+
25+
## Community Guidelines
26+
27+
This project follows [Google's Open Source Community
28+
Guidelines](https://opensource.google.com/conduct/).

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
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:
2+
- [ ] 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
3+
- [ ] Ensure the tests and linter pass
4+
- [ ] Code coverage does not decrease (if any source code was changed)
5+
- [ ] Appropriate docs were updated (if necessary)
6+
7+
Fixes #<issue_number_goes_here> 🦕

.github/release-please.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
releaseType: python
2+
handleGHRelease: true
3+
# NOTE: this section is generated by synthtool.languages.python
4+
# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py
5+
branches:
6+
- branch: v2
7+
handleGHRelease: true
8+
releaseType: python
9+
- branch: v1
10+
handleGHRelease: true
11+
releaseType: python
12+
- branch: v0
13+
handleGHRelease: true
14+
releaseType: python

.github/release-trigger.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enabled: true
2+
multiScmName: python-bigquery

.github/workflows/lint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- autogen
5+
# Trigger workflow on GitHub merge queue events
6+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group
7+
merge_group:
8+
types: [checks_requested]
9+
name: lint
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
21+
# See https://github.com/googleapis/google-cloud-python/issues/12013
22+
# and https://github.com/actions/checkout#checkout-head.
23+
with:
24+
fetch-depth: 2
25+
- name: Setup Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.13"
29+
- name: Install nox
30+
run: |
31+
python -m pip install --upgrade setuptools pip wheel
32+
python -m pip install nox
33+
- name: Run lint
34+
env:
35+
BUILD_TYPE: presubmit
36+
TEST_TYPE: lint
37+
# 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.
38+
PY_VERSION: "unused"
39+
run: |
40+
nox -s blacken lint

.github/workflows/unittest.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- autogen
5+
# Trigger workflow on GitHub merge queue events
6+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group
7+
merge_group:
8+
types: [checks_requested]
9+
name: unittest
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
unit:
16+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
17+
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
18+
# 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
19+
runs-on: ubuntu-22.04
20+
strategy:
21+
matrix:
22+
python: ['3.9', '3.10', "3.11", "3.12", "3.13"]
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
27+
# See https://github.com/googleapis/google-cloud-python/issues/12013
28+
# and https://github.com/actions/checkout#checkout-head.
29+
with:
30+
fetch-depth: 2
31+
- name: Setup Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python }}
35+
- name: Install nox
36+
run: |
37+
python -m pip install --upgrade setuptools pip wheel
38+
python -m pip install nox
39+
- name: Run unit tests
40+
env:
41+
COVERAGE_FILE: .coverage-${{ matrix.python }}
42+
BUILD_TYPE: presubmit
43+
TEST_TYPE: unit
44+
PY_VERSION: ${{ matrix.python }}
45+
run: |
46+
nox -s unit-${{ matrix.python }}
47+
- name: Upload coverage results
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: coverage-artifact-${{ '{{' }} matrix.python {{ '}}' }}
51+
path: .coverage-${{ matrix.python }}
52+
53+
cover:
54+
runs-on: ubuntu-latest
55+
needs:
56+
- unit
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
61+
# See https://github.com/googleapis/google-cloud-python/issues/12013
62+
# and https://github.com/actions/checkout#checkout-head.
63+
with:
64+
fetch-depth: 2
65+
- name: Setup Python
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: "3.10"
69+
- name: Set number of files changes in packages directory
70+
id: packages
71+
run: echo "::set-output name=num_files_changed::$(git diff HEAD~1 -- packages | wc -l)"
72+
- name: Install coverage
73+
if: steps.packages.num_files_changed > 0
74+
run: |
75+
python -m pip install --upgrade setuptools pip wheel
76+
python -m pip install coverage
77+
- name: Download coverage results
78+
if: ${{ steps.date.packages.num_files_changed > 0 }}
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: .coverage-results/
82+
- name: Report coverage results
83+
if: ${{ steps.date.packages.num_files_changed > 0 }}
84+
run: |
85+
find .coverage-results -type f -name '*.zip' -exec unzip {} \;
86+
coverage combine .coverage-results/**/.coverage*
87+
coverage report --show-missing --fail-under=100

google/cloud/bigquery_v2/services/centralized_services/client.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,3 @@ def list_models(
158158
"""
159159
kwargs = _drop_self_key(locals())
160160
return self.model_service_client.list_models(**kwargs)
161-
162-
163-
# ===============================================
164-
# Sample TODO: Relocate this to a samples file
165-
# ===============================================
166-
167-
# Instantiate BQClient class
168-
bqclient = BigQueryClient()
169-
170-
# Instantiate Request class
171-
get_dataset_request = GetDatasetRequest(
172-
project_id=PROJECT_ID,
173-
dataset_id="experimental",
174-
)
175-
176-
# Generate response
177-
dataset = bqclient.get_dataset(request=get_dataset_request)
178-
179-
# Display response
180-
print(f"GET DATASET:\n\t{dataset.id=}\n")

0 commit comments

Comments
 (0)