Skip to content

Commit 737958f

Browse files
committed
tests: consolidate docs presubmits
1 parent d80f278 commit 737958f

File tree

1 file changed

+54
-144
lines changed

1 file changed

+54
-144
lines changed

.github/workflows/docs.yml

Lines changed: 54 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -13,147 +13,57 @@ permissions:
1313
contents: read
1414

1515
jobs:
16-
# The two jobs "docs" and "docsfx" are marked as required checks
17-
# (and reset as such periodically) elsewhere in our
18-
# automation. Since we don't want to block non-release PRs on docs
19-
# failures, we want these checks to always show up as succeeded for
20-
# those PRs. For release PRs, we do want the checks to run and block
21-
# merge on failure.
22-
#
23-
# We accomplish this by using an "if:" conditional. Jobs
24-
# thus skipped via a conditional (i.e. a false condition) show as
25-
# having succeeded. See:
26-
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
27-
#
28-
# Since we want advance notice of docs errors, we also have two
29-
# corresponding non-required checks, the jobs "docs-warnings" and
30-
# "docfx-warnings", that run for all non-release PRs (i.e., when the
31-
# "docs" and "docfx" jobs don't run).
32-
#
33-
#
34-
# PLEASE ENSURE THE FOLLOWING AT ALL TIMES:
35-
#
36-
# - the "*-warnings" checks remain NON-REQUIRED in the repo
37-
# settings.
38-
#
39-
# - the steps for the jobs "docs" and "docfx" are identical to the
40-
# ones in "docs-warnings" and "docfx-warnings", respectively. We
41-
# will be able to avoid config duplication once GitHub actions
42-
# support YAML anchors (see
43-
# https://github.com/actions/runner/issues/1182)
44-
docs:
45-
if: github.actor == 'release-please[bot]'
46-
runs-on: ubuntu-latest
47-
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v6
50-
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
51-
# See https://github.com/googleapis/google-cloud-python/issues/12013
52-
# and https://github.com/actions/checkout#checkout-head.
53-
with:
54-
fetch-depth: 2
55-
- name: Setup Python
56-
uses: actions/setup-python@v6
57-
with:
58-
python-version: "3.10"
59-
- name: Install nox
60-
run: |
61-
python -m pip install --upgrade setuptools pip wheel
62-
python -m pip install nox
63-
- name: Run docs
64-
env:
65-
BUILD_TYPE: presubmit
66-
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
67-
TEST_TYPE: docs
68-
# 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.
69-
PY_VERSION: "unused"
70-
run: |
71-
ci/run_conditional_tests.sh
72-
docs-warnings:
73-
if: github.actor != 'release-please[bot]'
74-
name: "Docs warnings: will block release"
75-
continue-on-error: true
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Checkout
79-
uses: actions/checkout@v6
80-
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
81-
# See https://github.com/googleapis/google-cloud-python/issues/12013
82-
# and https://github.com/actions/checkout#checkout-head.
83-
with:
84-
fetch-depth: 2
85-
- name: Setup Python
86-
uses: actions/setup-python@v6
87-
with:
88-
python-version: "3.10"
89-
- name: Install nox
90-
run: |
91-
python -m pip install --upgrade setuptools pip wheel
92-
python -m pip install nox
93-
- name: Run docs
94-
env:
95-
BUILD_TYPE: presubmit
96-
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
97-
TEST_TYPE: docs
98-
# 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.
99-
PY_VERSION: "unused"
100-
run: |
101-
ci/run_conditional_tests.sh
102-
docfx:
103-
if: github.actor == 'release-please[bot]'
104-
runs-on: ubuntu-latest
105-
steps:
106-
- name: Checkout
107-
uses: actions/checkout@v6
108-
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
109-
# See https://github.com/googleapis/google-cloud-python/issues/12013
110-
# and https://github.com/actions/checkout#checkout-head.
111-
with:
112-
fetch-depth: 2
113-
- name: Setup Python
114-
uses: actions/setup-python@v6
115-
with:
116-
python-version: "3.10"
117-
- name: Install nox
118-
run: |
119-
python -m pip install --upgrade setuptools pip wheel
120-
python -m pip install nox
121-
- name: Run docfx
122-
env:
123-
BUILD_TYPE: presubmit
124-
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
125-
TEST_TYPE: docfx
126-
# 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.
127-
PY_VERSION: "unused"
128-
run: |
129-
ci/run_conditional_tests.sh
130-
docfx-warnings:
131-
if: github.actor != 'release-please[bot]'
132-
name: "Docfx warnings: will block release"
133-
continue-on-error: true
134-
runs-on: ubuntu-latest
135-
steps:
136-
- name: Checkout
137-
uses: actions/checkout@v6
138-
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
139-
# See https://github.com/googleapis/google-cloud-python/issues/12013
140-
# and https://github.com/actions/checkout#checkout-head.
141-
with:
142-
fetch-depth: 2
143-
- name: Setup Python
144-
uses: actions/setup-python@v6
145-
with:
146-
python-version: "3.10"
147-
- name: Install nox
148-
run: |
149-
python -m pip install --upgrade setuptools pip wheel
150-
python -m pip install nox
151-
- name: Run docfx
152-
env:
153-
BUILD_TYPE: presubmit
154-
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
155-
TEST_TYPE: docfx
156-
# 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.
157-
PY_VERSION: "unused"
158-
run: |
159-
ci/run_conditional_tests.sh
16+
docs:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6
21+
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
22+
# See https://github.com/googleapis/google-cloud-python/issues/12013
23+
# and https://github.com/actions/checkout#checkout-head.
24+
with:
25+
fetch-depth: 2
26+
- name: Setup Python
27+
uses: actions/setup-python@v6
28+
with:
29+
python-version: "3.10"
30+
- name: Install nox
31+
run: |
32+
python -m pip install --upgrade setuptools pip wheel
33+
python -m pip install nox
34+
- name: Run docs
35+
env:
36+
BUILD_TYPE: presubmit
37+
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
38+
TEST_TYPE: docs
39+
# 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.
40+
PY_VERSION: "unused"
41+
run: |
42+
ci/run_conditional_tests.sh
43+
docfx:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v6
48+
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
49+
# See https://github.com/googleapis/google-cloud-python/issues/12013
50+
# and https://github.com/actions/checkout#checkout-head.
51+
with:
52+
fetch-depth: 2
53+
- name: Setup Python
54+
uses: actions/setup-python@v6
55+
with:
56+
python-version: "3.10"
57+
- name: Install nox
58+
run: |
59+
python -m pip install --upgrade setuptools pip wheel
60+
python -m pip install nox
61+
- name: Run docfx
62+
env:
63+
BUILD_TYPE: presubmit
64+
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
65+
TEST_TYPE: docfx
66+
# 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.
67+
PY_VERSION: "unused"
68+
run: |
69+
ci/run_conditional_tests.sh

0 commit comments

Comments
 (0)