diff --git a/.github/workflows/ci-onto.yaml b/.github/workflows/ci-onto.yaml new file mode 100644 index 00000000..17fb3b61 --- /dev/null +++ b/.github/workflows/ci-onto.yaml @@ -0,0 +1,44 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ "ndc-mvp/0.1" ] + paths-ignore: + - "**/*.md" + - "**/*.rdf" + - "**/*.jsonld" + - "VocabolariControllati/**" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test-onto-syntax: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + architecture: 'x64' + - name: Run a script + run: |- + pip install pre-commit + pre-commit run -a onto-pyshacl + test-onto-latest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + architecture: 'x64' + - name: Run a script + run: |- + pip install pre-commit + pre-commit run -a onto-latest diff --git a/.github/workflows/ci-vocab.yaml b/.github/workflows/ci-vocab.yaml new file mode 100644 index 00000000..1d2e8d2e --- /dev/null +++ b/.github/workflows/ci-vocab.yaml @@ -0,0 +1,39 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ "ndc-mvp/0.1" ] + paths-ignore: + - "**/*.md" + - "**/*.rdf" + - "**/*.jsonld" + - "Ontologie/**" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test-vocabularies: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.8' # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + + # Runs a single command using the runners shell + - name: Run a script + run: |- + pip install pre-commit + pre-commit run -a vocab-pyshacl diff --git a/.gitignore b/.gitignore index 8a233769..7302e034 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ .DS_Store .DS_Store -*.xml \ No newline at end of file +*.xml +target/ +.project +.settings +.classpath +.~* + +*.jar + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..0e8b46f0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,94 @@ +# +# Run pre-commit hooks. You can run them without installing +# the hook with +# +# $ pre-commit run --all-files +# +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + # - id: trailing-whitespace + # - id: end-of-file-fixer + - id: check-yaml + args: [--allow-multiple-documents] + - id: check-added-large-files + args: + - "--maxkb=4000" +- repo: https://github.com/myint/autoflake + rev: v1.4 + hooks: + - id: autoflake + args: + - --in-place + - --remove-unused-variables + - --remove-all-unused-imports +- repo: https://github.com/psf/black + rev: 21.12b0 + hooks: + - id: black +- repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + name: isort (python) + # Use black profile for isort to avoid conflicts + # see https://github.com/PyCQA/isort/issues/1518 + args: ["--profile", "black"] + - id: isort + name: isort (cython) + types: [cython] + - id: isort + name: isort (pyi) + types: [pyi] +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 +- repo: https://github.com/Lucas-C/pre-commit-hooks-safety + rev: v1.2.2 + hooks: + - id: python-safety-dependencies-check +- repo: local + hooks: + - id: jsonschema + name: jsonschema + entry: python -m dati_playground validate --validate-jsonschema=true + files: '.*\.schema.yaml' + language: python + types: + - file + additional_dependencies: + - git+https://github.com/ioggstream/json-semantic-playground.git + - id: onto-pyshacl + name: pyshacl ontologies + entry: python -m dati_playground validate --validate-shacl=true + files: >- + ^Ontologie\/[^/]+\/latest/.*\.ttl + types: + - file + language: python + additional_dependencies: + - git+https://github.com/ioggstream/json-semantic-playground.git + - id: onto-latest + name: Ontologies latest validator + entry: python -m dati_playground validate --validate-versioned-directory=true + files: >- + ^Ontologie\/.*\.ttl + language: python + types: + - file + additional_dependencies: + - git+https://github.com/ioggstream/json-semantic-playground.git + - id: vocab-pyshacl + name: pyshacl vocabularies + entry: python -m dati_playground validate --validate-shacl=true + files: + ^VocabolariControllati\/.*\.ttl + language: python + types: + - file + additional_dependencies: + - git+https://github.com/ioggstream/json-semantic-playground.git