diff --git a/.github/workflows/gating.yaml b/.github/workflows/gating.yaml index 47b4b32..a46a044 100644 --- a/.github/workflows/gating.yaml +++ b/.github/workflows/gating.yaml @@ -90,3 +90,28 @@ jobs: # * DL3041 - Specify version with dnf install -y - ignore: DL3041 failure-threshold: warning + + validate-rule: + name: Validate Rule + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: Install Poetry + run: python -m pip install poetry + + - name: Install Dependencies + run: poetry install --only=main + + - name: Validate rule file + run: | + poetry run retasc validate-rule src/retasc/validator/example_rule.yaml | tee validation_output.log + + - name: Assert the rule file is valid + run: | + grep -q "The rule is valid." validation_output.log diff --git a/.github/workflows/update-schema.yaml b/.github/workflows/update-schema.yaml index afff7f4..0f132de 100644 --- a/.github/workflows/update-schema.yaml +++ b/.github/workflows/update-schema.yaml @@ -28,7 +28,7 @@ jobs: run: poetry install --only=main - name: Generate schema - run: retasc generate-schema schema.yaml + run: poetry run retasc generate-schema schema.yaml - name: Prepare deployment directory run: | diff --git a/src/retasc/validator/config.py b/src/retasc/validator/config.py deleted file mode 100644 index 182c428..0000000 --- a/src/retasc/validator/config.py +++ /dev/null @@ -1 +0,0 @@ -SCHEMA_VERSION = 1 diff --git a/src/retasc/validator/models.py b/src/retasc/validator/models.py index 1d9e4d3..b541a11 100644 --- a/src/retasc/validator/models.py +++ b/src/retasc/validator/models.py @@ -1,6 +1,6 @@ from pydantic import BaseModel, Field -from retasc.validator.config import SCHEMA_VERSION +SCHEMA_VERSION = 1 class JiraIssue(BaseModel): diff --git a/tests/test_config.py b/tests/test_config.py deleted file mode 100644 index 89347ba..0000000 --- a/tests/test_config.py +++ /dev/null @@ -1,7 +0,0 @@ -import retasc.validator.config as config - - -def test_schema_version_exists(): - assert hasattr( - config, "SCHEMA_VERSION" - ), "SCHEMA_VERSION is not defined in the config module"