-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workflow for HDMF Dev compatibility (#77)
- Loading branch information
Showing
3 changed files
with
329 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Check HDMF Dev Compatibility | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
check_compatibility: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel non-latest runs | ||
uses: styfle/cancel-workflow-action@0.11.0 | ||
with: | ||
all_but_latest: true | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Clone HDMF and Run HDMF tests | ||
run: | | ||
git clone https://github.com/hdmf-dev/hdmf.git --recurse-submodules | ||
cd hdmf | ||
python -m pip install -r requirements-dev.txt -r requirements.txt | ||
python -m pip install -e . | ||
cd src/hdmf/common/hdmf-common-schema | ||
git checkout ${{ github.head_ref }} # checkout branch | ||
cd ../../../.. | ||
pytest tests/unit/common/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Validate schema | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
validate: | ||
# run pipeline on either a push event or a PR event on a fork | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install dev branch of HDMF | ||
run: | | ||
pip install git+https://github.com/hdmf-dev/hdmf.git | ||
- name: Validate schema specification | ||
run: | | ||
validate_hdmf_spec common -m hdmf-common.schema.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,280 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "hdmf-common.schema.json", | ||
"title": "Schema for the HDMF Common specification", | ||
"description": "A schema for validating HDMF Common YAML Files", | ||
"version": "1.8.0", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"groups": {"$ref": "#/definitions/groups"}, | ||
"attributes": {"$ref": "#/definitions/attributes"}, | ||
"datasets": {"$ref": "#/definitions/datasets"}, | ||
"links": {"$ref": "#/definitions/links"}, | ||
"namespaces": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"name", | ||
"version", | ||
"author", | ||
"contact" | ||
], | ||
"properties": { | ||
"name": {"type": "string"}, | ||
"version": {"type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"}, | ||
"doc": {"type": "string"}, | ||
"author": {"type": "array", "items": {"type": "string"}}, | ||
"contact": {"type": "array", "items": {"type": "string", "format": "email"}}, | ||
"full_name": {"type": "string"}, | ||
"date": {"type": "string", "format": "date"}, | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"oneOf": [ | ||
{"required": ["namespace"]}, | ||
{"required": ["source"]} | ||
], | ||
"properties": { | ||
"namespace": {"type": "string"}, | ||
"doc": {"type": "string"}, | ||
"source": {"type": "string"}, | ||
"title": {"type": "string"}, | ||
"data_types": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"protectedString": { | ||
"type": "string", | ||
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$" | ||
}, | ||
"quantity": { | ||
"description": "Quantity marker", | ||
"anyOf": [ | ||
{ | ||
"type": "integer", | ||
"minimum": 1 | ||
}, | ||
{ | ||
"type": "string", | ||
"enum": [ | ||
"*", | ||
"?", | ||
"+", | ||
"zero_or_many", | ||
"one_or_many", | ||
"zero_or_one" | ||
] | ||
} | ||
] | ||
}, | ||
"flat_dtype": { | ||
"description": "Required string describing the data type of the attribute", | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
"enum": [ | ||
"float", | ||
"float32", | ||
"double", | ||
"float64", | ||
"long", | ||
"int64", | ||
"int", | ||
"int32", | ||
"int16", | ||
"int8", | ||
"uint", | ||
"uint32", | ||
"uint16", | ||
"uint8", | ||
"uint64", | ||
"numeric", | ||
"text", | ||
"utf", | ||
"utf8", | ||
"utf-8", | ||
"ascii", | ||
"bool", | ||
"isodatetime" | ||
] | ||
}, | ||
{"$ref": "#/definitions/ref_dtype"} | ||
] | ||
}, | ||
"dtype": { | ||
"anyOf": [ | ||
{"$ref": "#/definitions/flat_dtype"}, | ||
{"$ref": "#/definitions/compound_dtype"} | ||
] | ||
}, | ||
"dims": { | ||
"description": "Optional list describing the names of the dimensions of the data array stored by the attribute (default=None)", | ||
"type": "array", | ||
"items": { | ||
"anyOf": [ | ||
{"type": "string"}, | ||
{ | ||
"type": "array", | ||
"items": {"type": "string"} | ||
} | ||
] | ||
} | ||
}, | ||
"shape": { | ||
"description": "Optional list describing the allowed shape(s) of the data array stored by the attribute (default=None)", | ||
"anyOf": [ | ||
{"$ref": "#/definitions/shape_spec"}, | ||
{ | ||
"type": "array", | ||
"items": {"$ref": "#/definitions/shape_spec"} | ||
} | ||
] | ||
}, | ||
"shape_spec": { | ||
"type": "array", | ||
"items": { | ||
"anyOf": [ | ||
{ | ||
"type": "integer", | ||
"minimum": 1 | ||
}, | ||
{ | ||
"value": null | ||
} | ||
] | ||
} | ||
}, | ||
"ref_dtype": { | ||
"type": "object", | ||
"required": ["target_type", "reftype"], | ||
"properties": { | ||
"target_type": { | ||
"description": "Describes the data_type of the target that the reference points to", | ||
"type": "string" | ||
}, | ||
"reftype": { | ||
"description": "describes the kind of reference", | ||
"type": "string", | ||
"enum": ["ref", "reference", "object", "region"] | ||
} | ||
} | ||
}, | ||
"compound_dtype": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"required": ["name", "doc", "dtype"], | ||
"properties": { | ||
"name": {"$ref": "#/definitions/protectedString"}, | ||
"doc": {"type": "string"}, | ||
"dtype": {"$ref": "#/definitions/flat_dtype"} | ||
} | ||
} | ||
}, | ||
"groups": { | ||
"description": "list of groups", | ||
"type": "array", | ||
"items": { | ||
"title": "group", | ||
"type": "object", | ||
"required": ["doc"], | ||
"additionalProperties": false, | ||
"anyOf":[ | ||
{"required": ["data_type_def"]}, | ||
{"required": ["data_type_inc"]}, | ||
{"required": ["name"]} | ||
], | ||
"properties": { | ||
"name": {"$ref": "#/definitions/protectedString"}, | ||
"default_name": {"$ref": "#/definitions/protectedString"}, | ||
"doc": {"type": "string"}, | ||
"data_type_def": {"$ref": "#/definitions/protectedString"}, | ||
"data_type_inc": {"$ref": "#/definitions/protectedString"}, | ||
"quantity": {"$ref": "#/definitions/quantity"}, | ||
"linkable": {"type": "boolean"}, | ||
"datasets": {"$ref": "#/definitions/datasets"}, | ||
"links": {"$ref": "#/definitions/links"}, | ||
"groups": {"$ref": "#/definitions/groups"}, | ||
"attributes": {"$ref": "#/definitions/attributes"} | ||
} | ||
} | ||
}, | ||
"attributes": { | ||
"type": "array", | ||
"items": { | ||
"title": "attribute", | ||
"type": "object", | ||
"required": ["doc"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"dtype": {"$ref": "#/definitions/dtype"}, | ||
"dims": {"$ref": "#/definitions/dims"}, | ||
"shape": {"$ref": "#/definitions/shape"}, | ||
"name": {"type": "string"}, | ||
"doc": {"type": "string"}, | ||
"required": {"type": "boolean"}, | ||
"value": {"description": "Optional constant, fixed value for the attribute."}, | ||
"default_value": {"description": "Optional default value for variable-valued attributes."} | ||
} | ||
} | ||
}, | ||
"links": { | ||
"type": "array", | ||
"items": { | ||
"title": "link", | ||
"type": "object", | ||
"required": ["target_type", "doc"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"name": {"type": "string"}, | ||
"doc": {"type": "string"}, | ||
"target_type": {"type": "string"}, | ||
"quantity": {"$ref": "#/definitions/quantity"} | ||
} | ||
} | ||
}, | ||
"datasets": { | ||
"type": "array", | ||
"items": { | ||
"title": "dataset", | ||
"type": "object", | ||
"required": ["doc"], | ||
"additionalProperties": false, | ||
"anyOf":[ | ||
{"required": ["data_type_def"]}, | ||
{"required": ["data_type_inc"]}, | ||
{"required": ["name"]} | ||
], | ||
"properties": { | ||
"name": {"$ref": "#/definitions/protectedString"}, | ||
"default_name": {"$ref": "#/definitions/protectedString"}, | ||
"doc": {"type": "string"}, | ||
"dtype": {"$ref": "#/definitions/dtype"}, | ||
"dims": {"$ref": "#/definitions/dims"}, | ||
"shape": {"$ref": "#/definitions/shape"}, | ||
"data_type_def": {"$ref": "#/definitions/protectedString"}, | ||
"data_type_inc": {"$ref": "#/definitions/protectedString"}, | ||
"quantity": {"$ref": "#/definitions/quantity"}, | ||
"linkable": {"type": "boolean"}, | ||
"attributes": {"$ref": "#/definitions/attributes"}, | ||
"value": {"description": "Optional constant, fixed value for the attribute."}, | ||
"default_value": {"description": "Optional default value for variable-valued attributes."} | ||
} | ||
} | ||
} | ||
} | ||
} |