Skip to content

Commit a012d32

Browse files
committed
update
1 parent 71b585a commit a012d32

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

.jenkins/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ if [[ "${JOB_BASE_NAME}" == *worker_* ]]; then
105105

106106
# Step 5: Remove INVISIBLE_CODE_BLOCK from .html/.rst.txt/.ipynb/.py files
107107
bash $DIR/remove_invisible_code_block_batch.sh docs
108-
python .jenkins/validate_tutorials_built.py docs
108+
python .jenkins/validate_tutorials_built.py
109109

110110
# Step 6: Copy generated files to S3, tag with commit ID
111111
7z a worker_${WORKER_ID}.7z docs
@@ -139,7 +139,7 @@ elif [[ "${JOB_BASE_NAME}" == *manager ]]; then
139139

140140
# Step 5: Remove INVISIBLE_CODE_BLOCK from .html/.rst.txt/.ipynb/.py files
141141
bash $DIR/remove_invisible_code_block_batch.sh docs
142-
python .jenkins/validate_tutorials_built.py docs
142+
python .jenkins/validate_tutorials_built.py
143143

144144
# Step 6: Copy generated HTML files and static files to S3
145145
7z a manager.7z docs

.jenkins/validate_tutorials_built.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import sys
2-
import glob
3-
import re
1+
from pathlib import Path
2+
from typing import List
43

54
from bs4 import BeautifulSoup
65

6+
REPO_ROOT = Path(__file__).parent.parent
7+
78
# files that are ok to have 0 min 0 sec time, probably because they don't have any python code
89
OK_TO_NOT_RUN = [
910
"beginner/basics/intro.html",
@@ -69,14 +70,19 @@
6970
]
7071

7172

72-
def main():
73-
build_dir = sys.argv[1]
73+
def tutorial_source_dirs() -> List[Path]:
74+
return [
75+
p.relative_to(REPO_ROOT).with_stem(p.stem[:-7])
76+
for p in REPO_ROOT.glob("*_source")
77+
]
7478

75-
html_file_paths = []
7679

77-
for difficulty in ["beginner", "intermediate", "advanced", "prototype", "recipes"]:
78-
glob_path = f"{build_dir}/{difficulty}/**/*.html"
79-
html_file_paths += glob.glob(glob_path, recursive=True)
80+
def main() -> None:
81+
docs_dir = REPO_ROOT / "docs"
82+
html_file_paths = []
83+
for tutorial_source_dir in tutorial_source_dirs():
84+
glob_path = f"{tutorial_source_dir}/**/*.html"
85+
html_file_paths += docs_dir.glob(glob_path)
8086

8187
did_not_run = []
8288
for html_file_path in html_file_paths:
@@ -89,10 +95,10 @@ def main():
8995
"Total running time of the script: ( 0 minutes 0.000 seconds)"
9096
in elem.text
9197
and not any(
92-
html_file_path.endswith(file) for file in KNOWN_BAD + OK_TO_NOT_RUN
98+
html_file_path.match(file) for file in KNOWN_BAD + OK_TO_NOT_RUN
9399
)
94100
):
95-
did_not_run.append(html_file_path)
101+
did_not_run.append(html_file_path.as_posix())
96102

97103
if len(did_not_run) != 0:
98104
raise RuntimeError(

0 commit comments

Comments
 (0)