Skip to content

Commit 7fc9b45

Browse files
committed
tc
1 parent f433a26 commit 7fc9b45

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.jenkins/sphinx_files.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1+
import glob
2+
from pathlib import Path
3+
import shutil
14
import subprocess
25
import os
6+
from get_files_to_run import remove_other_files, compute_files_to_keep, calculate_shards, get_all_files
7+
from validate_tutorials_built import NOT_RUN
38

49
def main() -> None:
5-
files_to_run = os.environ["FILES_TO_RUN"]
10+
all_files = get_all_files()
11+
files_to_run = calculate_shards(all_files, num_shards=20)[int(os.environ.get("WORKER_ID", "1")) - 1]
12+
files_to_run = [x for x in files_to_run if x not in [f"{f}.py" for f in NOT_RUN]]
13+
14+
os.mkdir("docs_to_zip", exist_ok=True)
15+
616
env = os.environ.copy()
7-
for file in files_to_run.split(" "):
17+
for file in files_to_run:
18+
remove_other_files(all_files, compute_files_to_keep(file))
819
print(f"Running {file}")
9-
env["RUNTHIS"] = file
20+
stem = Path(file).stem
21+
env["RUNTHIS"] = stem
1022
subprocess.check_output(["make", "html"], env=env)
23+
for file in glob.glob(f"docs/**/*", recursive=True):
24+
if stem in file:
25+
shutil.copy(file, f"docs_to_zip/{file}")
26+
subprocess.check_output(["git", "reset", "--hard", "HEAD"])
27+
os.remove("docs")
28+
shutil.move("docs_to_zip", "docs")
1129

1230
if __name__ == "__main__":
1331
main()

0 commit comments

Comments
 (0)