diff --git a/.github/workflows/annotate.yml b/.github/workflows/annotate.yml index d992249..a2aa0fe 100644 --- a/.github/workflows/annotate.yml +++ b/.github/workflows/annotate.yml @@ -16,7 +16,7 @@ jobs: uses: ./ with: case-path: "./tests/data/" - case-version: "case-1.3.0" + case-version: "case-1.4.0" report-in-pr: "true" github-token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.repository }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 3eea15b..11ac956 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -21,11 +21,9 @@ jobs: # Lint the Dockerfile for syntax correctness and conformance with # standards. - name: Docker Lint - uses: luke142367/Docker-Lint-Action@v1.0.0 + uses: hadolint/hadolint-action@v3.1.0 with: - target: Dockerfile - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + dockerfile: Dockerfile test: runs-on: ubuntu-latest @@ -38,17 +36,17 @@ jobs: uses: ./ with: case-path: "./tests/data/simple-case.jsonld" - case-version: "case-1.3.0" + case-version: "case-1.4.0" - name: Run Action - Directory Filter uses: ./ with: case-path: "./tests/data/" - case-version: "case-1.3.0" + case-version: "case-1.4.0" extension-filter: "jsonld" - name: Run Action - Directory No Filter uses: ./ with: case-path: "./tests/data/" - case-version: "case-1.3.0" + case-version: "case-1.4.0" diff --git a/Dockerfile b/Dockerfile index 1d0d9b1..4d863c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM python:3.11-slim-bullseye WORKDIR /opt/workspace # Install dependencies -RUN python -m pip install case-utils==0.16.0 PyGithub +RUN python -m pip install --no-cache-dir case-utils==0.17.0 PyGithub==2.6.1 # Delete source files now that package has been installed WORKDIR /opt/workspace @@ -13,16 +13,16 @@ WORKDIR /opt/workspace COPY entrypoint.py /opt/workspace/entrypoint.py # Define the base path for the validation path -ENV CASE_PATH "/opt/json/" -ENV CASE_VERSION "case-1.3.0" -ENV CASE_EXTENSION_FILTER "" -ENV CASE_VALIDATE_ABORT "false" +ENV CASE_PATH="/opt/json/" +ENV CASE_VERSION="case-1.4.0" +ENV CASE_EXTENSION_FILTER="" +ENV CASE_VALIDATE_ABORT="false" # Required for annotating the GitHub pull request; optional otherwise -ENV REPORT_IN_PR "false" -ENV GITHUB_TOKEN "" -ENV GITHUB_REPOSITORY "" -ENV GITHUB_PULL_REQUEST "" +ENV REPORT_IN_PR="false" +ENV GITHUB_TOKEN="" +ENV GITHUB_REPOSITORY="" +ENV GITHUB_PULL_REQUEST="" # Define the command to run the entrypoint.py script that will detect the type # of the path that was provided, apply the filter extension (if appropriate) and diff --git a/README.md b/README.md index eb82fae..668fca0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ _This is an unofficial GitHub Action and not endorsed by the CASE Community or t guarantees are made to its accuracy or functionality._ [![Repository Checks](https://github.com/kchason/case-validation-action/actions/workflows/validate.yml/badge.svg)](https://github.com/kchason/case-validation-action/actions/workflows/validate.yml) -![CASE Version](https://img.shields.io/badge/CASE%20Version-1.2.0-brightgreen.svg) +![CASE Version](https://img.shields.io/badge/CASE%20Version-1.4.0-brightgreen.svg) [![Latest Tag](https://img.shields.io/github/v/tag/kchason/case-validation-action?label=action%20version)](https://github.com/kchason/case-validation-action/tags) [![Docker Build Status](https://img.shields.io/docker/cloud/build/kchason/case-validator)](https://hub.docker.com/repository/docker/kchason/case-validator) [![Docker Pulls](https://img.shields.io/docker/pulls/kchason/case-validator)](https://hub.docker.com/repository/docker/kchason/case-validator) @@ -27,10 +27,10 @@ Include the validation action in your GitHub action workflow and specify the fil ```yaml # Run the CASE validation job to confirm the output is valid - name: CASE Export Validation - uses: kchason/case-validation-action@v2.9.0 + uses: kchason/case-validation-action@v2.10.0 with: case-path: ./output/ - case-version: "case-1.3.0" + case-version: "case-1.4.0" extension-filter: "jsonld" report-in-pr: "true" github-token: ${{ secrets.GITHUB_TOKEN }} @@ -51,7 +51,7 @@ modified to fit custom use cases. # To run the latest image and remove the container after execution. docker run --rm \ -e CASE_PATH="/opt/case/" \ - -e CASE_VERSION="case-1.3.0" \ + -e CASE_VERSION="case-1.4.0" \ -e CASE_EXTENSION_FILTER="jsonld" \ -v "/path/to/local:/opt/case" \ kchason/case-validator:latest @@ -70,7 +70,7 @@ at [https://gitlab.com/keith.chason/case-validation-example](https://gitlab.com/ | Action Variable | Environment Variable | Description | Options | Default | |------------------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|--------------| | case-path | CASE_PATH | The path to the file or directory to be validated. | Any | /opt/json | -| case-version | CASE_VERSION | The version of the ontology against which the graph should be validatated. | "none", "case-0.5.0", "case-0.6.0" , "case-0.7.0", "case-0.7.1", "case-1.0.0", "case-1.1.0", "case-1.2.0", "case-1.3.0" | "case-1.3.0" | +| case-version | CASE_VERSION | The version of the ontology against which the graph should be validatated. | "none", "case-0.5.0", "case-0.6.0" , "case-0.7.0", "case-0.7.1", "case-1.0.0", "case-1.1.0", "case-1.2.0", "case-1.3.0", "case-1.4.0" | "case-1.4.0" | | extension-filter | CASE_EXTENSION_FILTER | The extension of only the files against which the validator should be run. Eg. `"json"`, `"jsonld"`, `"case"`. Defaults to `""` to run against all files defined in `case-path`. | Any | "" | | abort | CASE_VALIDATE_ABORT | Whether to abort the validator on the first failure | "true", "false" | "false" | | report-in-pr | REPORT_IN_PR | Whether or not to report the validation results in the pull request. Only reports if the action is triggered by a pull request. | "true", "false" | "false" | @@ -92,23 +92,49 @@ Conforms: True ### Non-Conforming +Supposing a file with these contents: + +```json +{ + "@context": { + "kb": "http://example.org/kb/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "uco-types": "https://ontology.unifiedcyberontology.org/uco/types/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@graph": [ + { + "@id": "kb:hash-25940dc2-4db9-4c01-9053-bc31f953fc4a", + "@type": "uco-types:Hash", + "rdfs:comment": "This node will pass validation.", + "uco-types:hashMethod": "SHA3-256", + "uco-types:hashValue": { + "@type": "xsd:hexBinary", + "@value": "c901cf247f1112334f51bdb5385db3b56d935f9fbc844c1b4a161b10c1c86d83" + } + }, + { + "@id": "kb:hash-b896ba81-f07c-4035-9277-a101eb6782c3", + "@type": "uco-types:Hash", + "rdfs:comment": "This node will trigger a validation error due to leaving hashValue's value as an untyped string.", + "uco-types:hashMethod": "SHA3-256", + "uco-types:hashValue": "4c6e44aab46ce9023dc82a006f18a06be8f3c64a6b12739be51e706b5adffeb5" + } + ] +} +``` + ``` -Validating file at ./output/case.json Validation Report Conforms: False -Results (2): -Constraint Violation in MinCountConstraintComponent (http://www.w3.org/ns/shacl#MinCountConstraintComponent): - Severity: sh:Violation - Source Shape: [ sh:class core:UcoObject ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:nodeKind sh:BlankNodeOrIRI ; sh:path core:object ] - Focus Node: kb:provenance-record-58e7566a-a934-4513-93b2-98fd43978a1c - Result Path: core:object - Message: Less than 1 values on kb:provenance-record-58e7566a-a934-4513-93b2-98fd43978a1c->core:object -Constraint Violation in MinCountConstraintComponent (http://www.w3.org/ns/shacl#MinCountConstraintComponent): +Results (1): +Constraint Violation in DatatypeConstraintComponent (http://www.w3.org/ns/shacl#DatatypeConstraintComponent): Severity: sh:Violation - Source Shape: [ sh:class core:UcoObject ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:nodeKind sh:BlankNodeOrIRI ; sh:path core:object ] - Focus Node: kb:provenance-record-a22fc197-6e53-4bc0-9832-d0b9f2b733d3 - Result Path: core:object - Message: Less than 1 values on kb:provenance-record-a22fc197-6e53-4bc0-9832-d0b9f2b733d3->core:object + Source Shape: [ sh:datatype xsd:hexBinary ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:nodeKind sh:Literal ; sh:path types:hashValue ] + Focus Node: kb:hash-b896ba81-f07c-4035-9277-a101eb6782c3 + Value Node: Literal("4c6e44aab46ce9023dc82a006f18a06be8f3c64a6b12739be51e706b5adffeb5") + Result Path: types:hashValue + Message: Value is not Literal with datatype xsd:hexBinary ``` ## GitHub Pull Request Decoration diff --git a/action.yml b/action.yml index 6f460f8..2787a42 100644 --- a/action.yml +++ b/action.yml @@ -10,9 +10,9 @@ inputs: required: false default: '/opt/json/' case-version: - description: 'The version of the ontology against which the graph should be validated. Options: "none", "case-0.5.0", "case-0.6.0", "case-0.7.0", "case-0.7.1", "case-1.0.0", "case-1.1.0", "case-1.2.0", "case-1.3.0"' + description: 'The version of the ontology against which the graph should be validated. Options: "none", "case-0.5.0", "case-0.6.0", "case-0.7.0", "case-0.7.1", "case-1.0.0", "case-1.1.0", "case-1.2.0", "case-1.3.0", "case-1.4.0"' required: false - default: 'case-1.3.0' + default: 'case-1.4.0' extension-filter: description: 'The extension of only the files against which the validator should be run. Eg. "json", "jsonld", "case". Defaults to "" to run against all files defined in `case-path`.' required: false @@ -39,7 +39,7 @@ inputs: default: '' runs: using: 'docker' - image: 'docker://kchason/case-validator:1.5.0' + image: 'docker://kchason/case-validator:1.6.0' env: CASE_PATH: ${{ inputs.case-path }} CASE_VERSION: ${{ inputs.case-version }}