Coder Social home page Coder Social logo

nrkno / yaml-schema-validator-github-action Goto Github PK

View Code? Open in Web Editor NEW
20.0 7.0 12.0 43 KB

A GitHub action that uses Yamale for YAML schema validation

License: MIT License

Dockerfile 31.73% Shell 68.27%
github-actions yaml yaml-schema validation schema-validation

yaml-schema-validator-github-action's Introduction

yaml-schema-validator-github-action

A GitHub action that uses Yamale for YAML schema validation.

Usage

  • Filenames are relative to the repository root.
  • Disable strict checking by setting no-strict to true, 1 or yes.
  • For help with the schema definitions and reference, see Yamale.

The following example sets up a check to validate a YAML file in your repository, target.yaml, using a schema defined in schemas/schema.yaml:

name: YAML schema validator
on: [push]

jobs:
  yaml-schema-validation:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout
    - uses: nrkno/yaml-schema-validator-github-action@v5
      with:
        schema: schemas/schema.yaml
        target: target.yaml
        # Uncomment to disable strict checks
        # no-strict: true

Versioning

This action is meant to be a wrapper around Yamale, so as of version 4.x of Yamale, this action will follow Yamale's major version scheme.

To bind the action to a specific release, suffix with @<tag>. E.g. nrkno/yaml-schema-validator-github-action@v4.

https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses

Developing

Create and enable a Python virtualenv

$ python -m venv venv
$ source venv/bin/activate

Install dependencies

$ pip install -r requirements.txt

Do a test-run with one of the provided examples

$ INPUT_SCHEMA=example/schema.yaml \
  INPUT_TARGET=example/file-valid-strict.yaml \
  ./entrypoint.sh

yaml-schema-validator-github-action's People

Contributors

dependabot[bot] avatar ibiqlik avatar stigok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

yaml-schema-validator-github-action's Issues

Getting requirements to build wheel did not run successfully

Running a GH workflow with:

      - uses: nrkno/yaml-schema-validator-github-action@v4

results in the following error:

Build container for action use: '/home/runner/work/_actions/nrkno/yaml-schema-validator-github-action/v4/Dockerfile'.
  /usr/bin/docker build -t c9a4a5:a35b09f1f2944d49bd9a3c60d604130f -f "/home/runner/work/_actions/nrkno/yaml-schema-validator-github-action/v4/Dockerfile" "/home/runner/work/_actions/nrkno/yaml-schema-validator-github-action/v4"
  Sending build context to Docker daemon  31.74kB
  
  Step 1/9 : FROM alpine:3
  3: Pulling from library/alpine
  Digest: sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1
  Status: Downloaded newer image for alpine:3
   ---> c1aabb73d233
  Step 2/9 : RUN apk add --no-cache bash python3 py3-pip   && mkdir -p /usr/src/app   && addgroup -g 10000 app   && adduser  -s /bin/bash -G app -u 10000 -h /usr/src/app -k /dev/null -D app   && python3 -m venv /usr/src/app/venv   && chown -R app:app /usr/src/app
   ---> Running in ae53afacb36f
  fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
  fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
  (1/26) Installing ncurses-terminfo-base (6.4_p20230506-r0)
  (2/26) Installing libncursesw (6.4_p20230506-r0)
  (3/26) Installing readline (8.2.1-r1)
  (4/26) Installing bash (5.2.15-r5)
  Executing bash-5.2.15-r5.post-install
  (5/26) Installing libbz2 (1.0.8-r5)
  (6/26) Installing libexpat (2.5.0-r1)
  (7/26) Installing libffi (3.4.4-r2)
  (8/26) Installing gdbm (1.23-r1)
  (9/26) Installing xz-libs (5.4.3-r0)
  (10/26) Installing libgcc (12.2.1_git20220924-r10)
  (11/26) Installing libstdc++ (12.2.1_git20220924-r10)
  (12/26) Installing mpdecimal (2.5.1-r2)
  (13/26) Installing libpanelw (6.4_p20230506-r0)
  (14/26) Installing sqlite-libs (3.41.2-r2)
  (15/26) Installing python3 (3.11.4-r0)
  (16/26) Installing python3-pycache-pyc0 (3.11.4-r0)
  (17/26) Installing pyc (0.1-r0)
  (18/26) Installing py3-setuptools-pyc (67.7.2-r0)
  (19/26) Installing py3-pip-pyc (23.1.2-r0)
  (20/26) Installing py3-parsing (3.0.9-r2)
  (21/26) Installing py3-parsing-pyc (3.0.9-r2)
  (22/26) Installing py3-packaging-pyc (23.1-r1)
  (23/26) Installing python3-pyc (3.11.4-r0)
  (24/26) Installing py3-packaging (23.1-r1)
  (25/26) Installing py3-setuptools (67.7.2-r0)
  (26/26) Installing py3-pip (23.1.2-r0)
  Executing busybox-1.36.1-r0.trigger
  OK: 77 MiB in 41 packages
  Removing intermediate container ae53afacb36f
   ---> e1a160d6d9d1
  Step 3/9 : WORKDIR /usr/src/app
   ---> Running in 775623d749a9
  Removing intermediate container 775623d749a9
   ---> 228fc0aec534
  Step 4/9 : USER 10000:10000
   ---> Running in bede9f511674
  Removing intermediate container bede9f511674
   ---> 19b7bcc4228b
  Step 5/9 : ENV VIRTUAL_ENV=/usr/src/app/venv     PATH=/usr/src/app/venv/bin:$PATH
   ---> Running in 0411cb83053f
  Removing intermediate container 0411cb83053f
   ---> 68d03b0ef98d
  Step 6/9 : COPY requirements.txt ./
   ---> 5dafa27d988f
  Step 7/9 : RUN pip install -r requirements.txt
   ---> Running in 1c752c9fd568
  Collecting yamale~=4.0.2 (from -r requirements.txt (line 1))
    Downloading yamale-4.0.4-py3-none-any.whl (55 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.0/55.0 kB 5.3 MB/s eta 0:00:00
  Collecting pyyaml (from yamale~=4.0.2->-r requirements.txt (line 1))
    Downloading PyYAML-6.0.tar.gz (124 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 17.2 MB/s eta 0:00:00
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    error: subprocess-exited-with-error
    
    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [54 lines of output]
        running egg_info
        writing lib/PyYAML.egg-info/PKG-INFO
        writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
        writing top-level names to lib/PyYAML.egg-info/top_level.txt
        Traceback (most recent call last):
          File "/usr/src/app/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
            main()
          File "/usr/src/app/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/src/app/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
            return hook(config_settings)
                   ^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
            return self._get_build_requires(config_settings, requirements=['wheel'])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
            self.run_setup()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
            exec(code, locals())
          File "<string>", line 288, in <module>
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
            return distutils.core.setup(**attrs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
            return run_commands(dist)
                   ^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
            dist.run_commands()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
            self.run_command(cmd)
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 314, in run
            self.find_sources()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 322, in find_sources
            mm.run()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 551, in run
            self.add_defaults()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults
            sdist.add_defaults(self)
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 104, in add_defaults
            super().add_defaults()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
            self._add_defaults_ext()
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
            self.filelist.extend(build_ext.get_source_files())
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "<string>", line 204, in get_source_files
          File "/tmp/pip-build-env-lx181k_h/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
            raise AttributeError(attr)
        AttributeError: cython_sources
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  
  Notice:  A new release of pip is available: 23.1.2 -> 23.2
  Notice:  To update, run: pip install --upgrade pip
  The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

Any idea what might be happening and how to resolve it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.