Skip to content

Commit e8dd89b

Browse files
chore(tests): re-introduce docfx pre-submit (#18589)
Docfx was recently moved to a post-submit test due to its speed. With sharding, combined with [performance optimizations in `gcp-sphinx-docfx-yaml`](#18588), we can run it within 10 minutes, and keep it pre-submit This PR also installs `gcp-sphinx-docfx-yaml` from HEAD for the docfx test, rather than from pypi
1 parent bbdd643 commit e8dd89b

1 file changed

Lines changed: 40 additions & 7 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 40 additions & 7 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:
@@ -24,6 +21,7 @@ env:
2421
NOX_ENVDIR: "/tmp/shared_nox_envs"
2522
NOX_DEFAULT_VENV_BACKEND: "uv"
2623
UV_VENV_SEED: "1"
24+
UV_CONCURRENT_BUILDS: "1"
2725
# Run checks in parallel using 4 cores
2826
PARALLEL_WORKERS: "4"
2927

@@ -41,7 +39,7 @@ jobs:
4139
PACKAGE_WEIGHTS: |
4240
google-ads-admanager: 9
4341
google-cloud-compute: 50
44-
google-cloud-compute-v1beta: 100
42+
google-cloud-compute-v1beta: 120
4543
google-cloud-dialogflow: 9
4644
google-cloud-dialogflow-cx: 9
4745
google-cloud-discoveryengine: 15
@@ -136,9 +134,15 @@ jobs:
136134
fi
137135
echo "All docs shards passed or were skipped!"
138136
139-
docfx:
140-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
137+
docfx-shard:
138+
needs: initialize
139+
if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != ''
141140
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) }}
142146
steps:
143147
- name: Checkout
144148
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -156,12 +160,41 @@ jobs:
156160
run: |
157161
python -m pip install --upgrade setuptools pip wheel
158162
python -m pip install nox uv
159-
- name: Run docfx
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 }}
160174
env:
161175
BUILD_TYPE: presubmit
162176
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }}
163177
TEST_TYPE: docfx
178+
PACKAGE_LIST: ${{ matrix.package_shard.packages }}
164179
# 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.
165180
PY_VERSION: "unused"
166181
run: |
167182
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)