Skip to content

Commit 3b01698

Browse files
authored
Merge pull request #420 from bioimage-io/oeway-patch-1
Add requirements.txt
2 parents ea3e4e5 + 9158805 commit 3b01698

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

_headers

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/*
2+
Access-Control-Allow-Origin: *

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<noscript><meta id="redirect" http-equiv="refresh" content="0; url=https://bioimage.io/#/"></noscript>
5+
</head>
6+
7+
<body>
8+
Redirecting to bioimage.io preview...
9+
10+
<!-- Redirect in JavaScript with meta refresh fallback above in noscript -->
11+
<script>
12+
window.location.href = window.location.href.split("?")[0].replace('index.html', '') + 'collection.json';
13+
</script>
14+
</body>
15+
</html>

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bioimageio.spec
2+
bioimageio.core
3+
lxml
4+
typer
5+
boltons

scripts/run_main_ci_equivalent_local.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ def end_of_job(dist: Path, always_continue: bool):
3030
shutil.rmtree(str(dist))
3131

3232

33-
def main(always_continue: bool = True, skip_update_external: bool = True):
33+
def main(always_continue: bool = True, skip_update_external: bool = False, with_state: bool = False):
34+
""" run a close equivalent to the 'update collection' (auto_update_main.yaml) workflow.
35+
# todo: improve this script and substitute the GitHub Actions CI with it in order to make deployment more transparent
36+
37+
Args:
38+
always_continue: Set to False for debugging to pause between individual deployment steps
39+
skip_update_external: Don't query zenodo.org for new relevant records
40+
with_state: checkout current 'gh-pages' branch and 'lst_ci_run" tag to evaluate difference only
41+
42+
"""
3443
# local setup
3544
collection = Path(__file__).parent / "../collection"
3645

@@ -44,13 +53,21 @@ def main(always_continue: bool = True, skip_update_external: bool = True):
4453

4554
gh_pages = Path(__file__).parent / "../gh-pages"
4655
if not gh_pages.exists():
47-
subprocess.run(["git", "worktree", "prune"], check=True)
48-
subprocess.run(["git", "worktree", "add", "--detach", str(gh_pages), "gh-pages"], check=True)
56+
if with_state:
57+
subprocess.run(["git", "worktree", "prune"], check=True)
58+
subprocess.run(["git", "worktree", "add", "--detach", str(gh_pages), "gh-pages"], check=True)
59+
else:
60+
gh_pages.mkdir()
4961

5062
last_collection = Path(__file__).parent / "../last_ci_run/collection"
5163
if not last_collection.parent.exists():
52-
subprocess.run(["git", "worktree", "prune"], check=True)
53-
subprocess.run(["git", "worktree", "add", "--detach", str(last_collection.parent), "last_ci_run"], check=True)
64+
if with_state:
65+
subprocess.run(["git", "worktree", "prune"], check=True)
66+
subprocess.run(
67+
["git", "worktree", "add", "--detach", str(last_collection.parent), "last_ci_run"], check=True
68+
)
69+
else:
70+
last_collection.mkdir(parents=True)
5471

5572
dist = Path(__file__).parent / "../dist"
5673
if dist.exists():
@@ -137,6 +154,10 @@ def main(always_continue: bool = True, skip_update_external: bool = True):
137154

138155
end_of_job(dist, always_continue)
139156

157+
# copy _header and index.html file in order to enable a valid bioimage.io preview
158+
shutil.copy("_headers", str(gh_pages / "_headers"))
159+
shutil.copy("index.html", str(gh_pages / "index.html"))
160+
140161

141162
if __name__ == "__main__":
142163
typer.run(main)

0 commit comments

Comments
 (0)