Skip to content

Commit 76eafa3

Browse files
committed
chore(tests): re-introduce docfx pre-submit
1 parent 7a1c741 commit 76eafa3

1 file changed

Lines changed: 40 additions & 4 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ env:
2424
NOX_ENVDIR: "/tmp/shared_nox_envs"
2525
NOX_DEFAULT_VENV_BACKEND: "uv"
2626
UV_VENV_SEED: "1"
27+
UV_CONCURRENT_BUILDS: "1"
2728
# Run checks in parallel using 4 cores
2829
PARALLEL_WORKERS: "4"
2930

@@ -41,7 +42,7 @@ jobs:
4142
PACKAGE_WEIGHTS: |
4243
google-ads-admanager: 9
4344
google-cloud-compute: 50
44-
google-cloud-compute-v1beta: 100
45+
google-cloud-compute-v1beta: 120
4546
google-cloud-dialogflow: 9
4647
google-cloud-dialogflow-cx: 9
4748
google-cloud-discoveryengine: 15
@@ -136,9 +137,15 @@ jobs:
136137
fi
137138
echo "All docs shards passed or were skipped!"
138139
139-
docfx:
140-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
140+
docfx-shard:
141+
needs: initialize
142+
if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != ''
141143
runs-on: ubuntu-latest
144+
strategy:
145+
fail-fast: true
146+
matrix:
147+
package_shard: ${{ fromJson(needs.initialize.outputs.matrix) }}
148+
name: ${{ matrix.package_shard.is_sharded && format('docfx ({0})', matrix.package_shard.name) || format('docfx ({0})', matrix.package_shard.description) }}
142149
steps:
143150
- name: Checkout
144151
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -156,12 +163,41 @@ jobs:
156163
run: |
157164
python -m pip install --upgrade setuptools pip wheel
158165
python -m pip install nox uv
159-
- name: Run docfx
166+
- name: Build local gcp-sphinx-docfx-yaml wheel
167+
run: |
168+
mkdir -p /tmp/local_wheels
169+
python -m pip wheel --no-deps packages/gcp-sphinx-docfx-yaml -w /tmp/local_wheels
170+
WHEEL_PATH=$(ls /tmp/local_wheels/gcp_sphinx_docfx_yaml-*.whl)
171+
echo "Built local wheel: ${WHEEL_PATH}"
172+
echo "gcp-sphinx-docfx-yaml @ file://${WHEEL_PATH}" > /tmp/uv_overrides.txt
173+
echo "UV_OVERRIDE=/tmp/uv_overrides.txt" >> $GITHUB_ENV
174+
echo "UV_FIND_LINKS=/tmp/local_wheels" >> $GITHUB_ENV
175+
echo "PIP_FIND_LINKS=/tmp/local_wheels" >> $GITHUB_ENV
176+
- name: Run docfx for ${{ matrix.package_shard.description }}
160177
env:
161178
BUILD_TYPE: presubmit
162179
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }}
163180
TEST_TYPE: docfx
181+
PACKAGE_LIST: ${{ matrix.package_shard.packages }}
164182
# 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.
165183
PY_VERSION: "unused"
166184
run: |
167185
ci/run_conditional_tests.sh
186+
187+
docfx:
188+
if: always()
189+
needs: [initialize, docfx-shard]
190+
runs-on: ubuntu-latest
191+
name: docfx
192+
steps:
193+
- name: Check docfx job status
194+
run: |
195+
if [[ "${{ needs.initialize.result }}" != "success" ]]; then
196+
echo "Error: The initialize job status was: ${{ needs.initialize.result }}"
197+
exit 1
198+
fi
199+
if [[ "${{ needs['docfx-shard'].result }}" != "success" && "${{ needs['docfx-shard'].result }}" != "skipped" ]]; then
200+
echo "docfx failed with result: ${{ needs['docfx-shard'].result }}"
201+
exit 1
202+
fi
203+
echo "All docfx shards passed or were skipped!"

0 commit comments

Comments
 (0)