Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d21a27

Browse files
authored
DOC: fail the CI build and do not deploy if docs are not created (#23065)
Adds protection against deploying empty docs when sphinx build fails in circleCI.
1 parent 6ff22e2 commit 3d21a27

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

.circleci/config.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ jobs:
8888
cd doc
8989
# Don't use -q, show warning summary"
9090
SPHINXOPTS="-j2 -n" make -e html || echo "ignoring errors for now, see gh-13114"
91+
if [[ $(find build/html -type f | wc -l) -lt 1000 ]]; then
92+
echo "doc build failed: build/html is empty"
93+
exit -1
94+
fi
9195
9296
- run:
9397
name: build neps
@@ -128,11 +132,12 @@ jobs:
128132
touch doc/build/html/.nojekyll
129133
130134
./tools/ci/push_docs_to_repo.py doc/build/html \
131-
[email protected]:numpy/devdocs.git \
132135
--committer "numpy-circleci-bot" \
133136
--email "numpy-circleci-bot@nomail" \
134137
--message "Docs build of $CIRCLE_SHA1" \
135-
--force
138+
--count 5 \
139+
--force \
140+
[email protected]:numpy/devdocs.git
136141
137142
- add_ssh_keys:
138143
fingerprints:
@@ -153,11 +158,12 @@ jobs:
153158
touch doc/neps/_build/html/.nojekyll
154159
155160
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
156-
[email protected]:numpy/neps.git \
157161
--committer "numpy-circleci-bot" \
158162
--email "numpy-circleci-bot@nomail" \
159163
--message "Docs build of $CIRCLE_SHA1" \
160-
--force
164+
--count 5 \
165+
--force \
166+
[email protected]:numpy/neps.git \
161167
162168
workflows:
163169
version: 2

tools/ci/push_docs_to_repo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
help='Name of the git committer')
2020
parser.add_argument('--email', default='numpy-commit-bot@nomail',
2121
help='Email of the git committer')
22+
parser.add_argument('--count', default=1, type=int,
23+
help="minimum number of expected files, defaults to 1")
2224

2325
parser.add_argument(
2426
'--force', action='store_true',
@@ -31,6 +33,11 @@
3133
print('Content directory does not exist')
3234
sys.exit(1)
3335

36+
count = len([name for name in os.listdir(args.dir) if os.path.isfile(os.path.join(args.dir, name))])
37+
38+
if count < args.count:
39+
print(f"Expected {args.count} top-directory files to upload, got {count}")
40+
sys.exit(1)
3441

3542
def run(cmd, stdout=True):
3643
pipe = None if stdout else subprocess.DEVNULL

0 commit comments

Comments
 (0)