Skip to content

Commit aaaca40

Browse files
committed
Merge branch 'main' into spanner-optimize-query-param-encoding
2 parents b5197da + 05b3775 commit aaaca40

5,123 files changed

Lines changed: 1038645 additions & 90074 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/docs.yml‎

Lines changed: 135 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ on:
33
branches:
44
- main
55
pull_request:
6-
branches:
7-
- main
8-
- preview
96
# Trigger workflow on GitHub merge queue events
107
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group
118
merge_group:
@@ -15,9 +12,82 @@ name: docs
1512
permissions:
1613
contents: read
1714

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
env:
20+
NOX_REUSE_EXISTING_VIRTUALENVS: "true"
21+
NOX_ENVDIR: "/tmp/shared_nox_envs"
22+
NOX_DEFAULT_VENV_BACKEND: "uv"
23+
UV_VENV_SEED: "1"
24+
UV_CONCURRENT_BUILDS: "1"
25+
# Run checks in parallel using 4 cores
26+
PARALLEL_WORKERS: "4"
27+
1828
jobs:
19-
docs:
29+
initialize:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
matrix: ${{ steps.set-matrix.outputs.matrix }}
33+
is_full_run: ${{ steps.check-label.outputs.is_full_run }}
34+
env:
35+
MAX_SHARDS: 5
36+
MIN_SHARD_WEIGHT: 25
37+
# Define weights for packages with large autodoc workloads to balance shard execution time
38+
# Default for unset packages is 1
39+
PACKAGE_WEIGHTS: |
40+
google-ads-admanager: 9
41+
google-cloud-compute: 50
42+
google-cloud-compute-v1beta: 120
43+
google-cloud-dialogflow: 9
44+
google-cloud-dialogflow-cx: 9
45+
google-cloud-discoveryengine: 15
46+
google-cloud-network-security: 9
47+
google-cloud-retail: 9
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
51+
with:
52+
fetch-depth: 0
53+
filter: blob:none
54+
persist-credentials: false
55+
- name: Check for unit_test:all_packages label
56+
id: check-label
57+
run: |
58+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'unit_test:all_packages') }}" == "true" ]]; then
59+
echo "is_full_run=true" >> $GITHUB_OUTPUT
60+
else
61+
echo "is_full_run=false" >> $GITHUB_OUTPUT
62+
fi
63+
- name: Setup Python
64+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
65+
with:
66+
python-version: "3.10"
67+
- name: Get package shards
68+
id: set-matrix
69+
env:
70+
BUILD_TYPE: presubmit
71+
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }}
72+
TEST_ALL_PACKAGES: ${{ steps.check-label.outputs.is_full_run }}
73+
MAX_SHARDS: ${{ env.MAX_SHARDS }}
74+
MIN_SHARD_WEIGHT: ${{ env.MIN_SHARD_WEIGHT }}
75+
PACKAGE_WEIGHTS: ${{ env.PACKAGE_WEIGHTS }}
76+
run: |
77+
if [ -n "$TARGET_BRANCH" ]; then
78+
git fetch --no-tags --quiet origin "$TARGET_BRANCH" || true
79+
fi
80+
python3 ci/get_package_shards.py
81+
82+
docs-shard:
83+
needs: initialize
84+
if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != ''
2085
runs-on: ubuntu-latest
86+
strategy:
87+
fail-fast: true
88+
matrix:
89+
package_shard: ${{ fromJson(needs.initialize.outputs.matrix) }}
90+
name: ${{ matrix.package_shard.is_sharded && format('docs ({0})', matrix.package_shard.name) || format('docs ({0})', matrix.package_shard.description) }}
2191
steps:
2292
- name: Checkout
2393
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -34,19 +104,45 @@ jobs:
34104
- name: Install nox
35105
run: |
36106
python -m pip install --upgrade setuptools pip wheel
37-
python -m pip install nox
38-
- name: Run docs
107+
python -m pip install nox uv
108+
- name: Run docs for ${{ matrix.package_shard.description }}
39109
env:
40110
BUILD_TYPE: presubmit
41111
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }}
42112
TEST_TYPE: docs
113+
PACKAGE_LIST: ${{ matrix.package_shard.packages }}
43114
# 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.
44115
PY_VERSION: "unused"
45116
run: |
46117
ci/run_conditional_tests.sh
47-
docfx:
48-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
118+
119+
docs:
120+
if: always()
121+
needs: [initialize, docs-shard]
49122
runs-on: ubuntu-latest
123+
name: docs
124+
steps:
125+
- name: Check docs job status
126+
run: |
127+
if [[ "${{ needs.initialize.result }}" != "success" ]]; then
128+
echo "Error: The initialize job status was: ${{ needs.initialize.result }}"
129+
exit 1
130+
fi
131+
if [[ "${{ needs['docs-shard'].result }}" != "success" && "${{ needs['docs-shard'].result }}" != "skipped" ]]; then
132+
echo "docs failed with result: ${{ needs['docs-shard'].result }}"
133+
exit 1
134+
fi
135+
echo "All docs shards passed or were skipped!"
136+
137+
docfx-shard:
138+
needs: initialize
139+
if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != ''
140+
runs-on: ubuntu-latest
141+
strategy:
142+
fail-fast: true
143+
matrix:
144+
package_shard: ${{ fromJson(needs.initialize.outputs.matrix) }}
145+
name: ${{ matrix.package_shard.is_sharded && format('docfx ({0})', matrix.package_shard.name) || format('docfx ({0})', matrix.package_shard.description) }}
50146
steps:
51147
- name: Checkout
52148
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -63,13 +159,42 @@ jobs:
63159
- name: Install nox
64160
run: |
65161
python -m pip install --upgrade setuptools pip wheel
66-
python -m pip install nox
67-
- name: Run docfx
162+
python -m pip install nox uv
163+
- name: Build local gcp-sphinx-docfx-yaml wheel
164+
run: |
165+
mkdir -p /tmp/local_wheels
166+
python -m pip wheel --no-deps packages/gcp-sphinx-docfx-yaml -w /tmp/local_wheels
167+
WHEEL_PATH=$(ls /tmp/local_wheels/gcp_sphinx_docfx_yaml-*.whl)
168+
echo "Built local wheel: ${WHEEL_PATH}"
169+
echo "gcp-sphinx-docfx-yaml @ file://${WHEEL_PATH}" > /tmp/uv_overrides.txt
170+
echo "UV_OVERRIDE=/tmp/uv_overrides.txt" >> $GITHUB_ENV
171+
echo "UV_FIND_LINKS=/tmp/local_wheels" >> $GITHUB_ENV
172+
echo "PIP_FIND_LINKS=/tmp/local_wheels" >> $GITHUB_ENV
173+
- name: Run docfx for ${{ matrix.package_shard.description }}
68174
env:
69175
BUILD_TYPE: presubmit
70176
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }}
71177
TEST_TYPE: docfx
178+
PACKAGE_LIST: ${{ matrix.package_shard.packages }}
72179
# 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.
73180
PY_VERSION: "unused"
74181
run: |
75182
ci/run_conditional_tests.sh
183+
184+
docfx:
185+
if: always()
186+
needs: [initialize, docfx-shard]
187+
runs-on: ubuntu-latest
188+
name: docfx
189+
steps:
190+
- name: Check docfx job status
191+
run: |
192+
if [[ "${{ needs.initialize.result }}" != "success" ]]; then
193+
echo "Error: The initialize job status was: ${{ needs.initialize.result }}"
194+
exit 1
195+
fi
196+
if [[ "${{ needs['docfx-shard'].result }}" != "success" && "${{ needs['docfx-shard'].result }}" != "skipped" ]]; then
197+
echo "docfx failed with result: ${{ needs['docfx-shard'].result }}"
198+
exit 1
199+
fi
200+
echo "All docfx shards passed or were skipped!"

0 commit comments

Comments
 (0)