Skip to content

Commit 5349a1b

Browse files
committed
ignore rdf source field in validation...
if not deploying to gh-pages
1 parent e81e631 commit 5349a1b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/validate_resources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: dynamic validation
9898
shell: bash -l {0}
9999
timeout-minutes: 30
100-
run: python scripts/dynamic_validation.py dist/dynamic_validation_artifact ${{ matrix.resource_id }} ${{ matrix.version_id }} ${{ matrix.weight_format }} --create-env-outcome ${{ steps.create_env.outcome }}
100+
run: python scripts/dynamic_validation.py dist/dynamic_validation_artifact ${{ matrix.resource_id }} ${{ matrix.version_id }} ${{ matrix.weight_format }} --create-env-outcome ${{ steps.create_env.outcome }} --${{ contains(inputs.deploy_to, 'gh-pages') && 'no-ignore' || 'ignore' }}-rdf-source-field-in-validation
101101
- name: Upload validation summary
102102
uses: actions/upload-artifact@v2
103103
with:

scripts/dynamic_validation.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from typing import List, Optional
44

55
import typer
6+
from marshmallow import missing
67

8+
from bioimageio.spec import load_raw_resource_description
79
from bioimageio.spec.shared import yaml
810

911

@@ -20,6 +22,8 @@ def main(
2022
weight_format: Optional[str] = typer.Argument(..., help="weight format to test model with."),
2123
rdf_dirs: List[Path] = (Path(__file__).parent / "../artifacts/static_validation_artifact",),
2224
create_env_outcome: str = "success",
25+
# rdf_source might assume a resource has been deployed, if not (e.g. in a PR), rdf_source is expected to be invalid.
26+
ignore_rdf_source_field_in_validation: bool = False,
2327
):
2428
if weight_format is None:
2529
# no dynamic tests for non-model resources...
@@ -45,9 +49,14 @@ def main(
4549
summary = test_summary_from_exception("check for test kwargs", e)
4650
else:
4751
try:
48-
summary = test_resource(rdf_path, weight_format=weight_format, **test_kwargs)
52+
rd = load_raw_resource_description(rdf_path)
53+
if ignore_rdf_source_field_in_validation:
54+
rd.rdf_source = missing
55+
56+
summary = test_resource(rd, weight_format=weight_format, **test_kwargs)
4957
except Exception as e:
5058
summary = test_summary_from_exception("call 'test_resource'", e)
59+
5160
else:
5261
env_path = dist / "static_validation_artifact" / resource_id / version_id / f"conda_env_{weight_format}.yaml"
5362
if env_path.exists():

0 commit comments

Comments
 (0)