Commit af4d360b authored by Mark Canterbury's avatar Mark Canterbury
Browse files

Merge branch 'maintenance/json_testing' into 'meeting/LI69'

Adds JSON testing

See merge request !237
parents 5f634638 daedfa1a
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -6,3 +6,8 @@ root = true
indent_style = space
indent_style = space
indent_size = 4
indent_size = 4
trim_trailing_whitespace = true
trim_trailing_whitespace = true

[**.json]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
+2 −0
Original line number Original line Diff line number Diff line
@@ -2,6 +2,8 @@
.vscode/
.vscode/
.idea/
.idea/


testing/dockerfiles/build.log

# Vagrant
# Vagrant
.vagrant/
.vagrant/


+96 −8
Original line number Original line Diff line number Diff line
@@ -7,9 +7,14 @@ workflow:


stages:
stages:
  - preflight
  - preflight
  - check
  - compile
  - lint
  - build
  - build



# -----------------------------------------------------------
# Preflight

preflight:
preflight:
  image: "forge.etsi.org:5050/li/schemas-definitions/forgelib"
  image: "forge.etsi.org:5050/li/schemas-definitions/forgelib"
  stage: preflight
  stage: preflight
@@ -19,19 +24,102 @@ preflight:
  script:
  script:
    - forgelib-preflight https://$CI_SERVER_HOST $CI_PROJECT_ID $CI_MERGE_REQUEST_IID
    - forgelib-preflight https://$CI_SERVER_HOST $CI_PROJECT_ID $CI_MERGE_REQUEST_IID


process_asn:

# -----------------------------------------------------------
# Compile

compile_asn:
  image: "forge.etsi.org:5050/li/schemas-definitions/asn1test:latest"
  image: "forge.etsi.org:5050/li/schemas-definitions/asn1test:latest"
  stage: check
  stage: compile
  interruptible: true
  interruptible: true
  script:
  script:
    - python3 testing/asn_process.py
    - python3 testing/asn/asn_process.py


process_xsd:
compile_xsd:
  image: "forge.etsi.org:5050/li/schemas-definitions/xsdtest:latest"
  image: "forge.etsi.org:5050/li/schemas-definitions/forgeschema:latest"
  stage: check
  stage: compile
  interruptible: true
  interruptible: true
  script:
  script:
    - python3 testing/xsd_process.py
    - export PYCHARM_HOSTED=1
    - |
      check_count=0
      fail_count=0
      while IFS= read -r -d '' file; do
        let "check_count=check_count+1"      
        if ! forgeschema -c "$file"; then
          echo "❌ failed schema checks for $file"
          let "fail_count=fail_count+1"
        fi
        echo ""
        echo "..."
        echo ""
      done < <(find ./testing/xml -type f -name "*.json" -print0)
      if [ "$fail_count" -gt 0 ]; then
        echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
        echo "❌ Failed schema checks for $fail_count of $check_count files"
        echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
        exit 1
      fi
      echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
      echo "✅ XSD validation OK ($check_count files checked)"  
      echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
      echo "✅ XSD validation OK for $file"

compile_json:
  image: "forge.etsi.org:5050/li/schemas-definitions/forgeschema:latest"
  stage: compile
  interruptible: true
  script:
    - export PYCHARM_HOSTED=1
    - |
      check_count=0
      fail_count=0
      while IFS= read -r -d '' file; do
        let "check_count=check_count+1"
        if ! forgeschema -c "$file"; then
          echo "❌ failed schema checks for $file"
          let "fail_count=fail_count+1"
        fi
        echo ""
        echo "..."
        echo ""
      done < <(find ./testing/json -type f -name "*.json" -print0)
      if [ "$fail_count" -gt 0 ]; then
        echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
        echo "❌ Failed schema checks for $fail_count of $check_count files"
        echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
        exit 1
      fi
      echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
      echo "✅ JSON validation OK ($check_count files checked)"  
      echo "┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅"
    - forgeschema -s 103120/schema/json/ts_103120_Core.schema.json -u 103120/schema/json -u 103120/dictionaries/ts_103120_Dictionaries.schema.json -u 103280/TS_103_280.schema.json -i 103120/examples/json


# -----------------------------------------------------------
# Lint

lint_xml:
  image: "forge.etsi.org:5050/li/schemas-definitions/forgeschema:latest"
  stage: lint
  interruptible: true
  allow_failure: true
  script:
    - export PYCHARM_HOSTED=1
    - python testing/xml/lint_xml.py

lint_json:
  image: "forge.etsi.org:5050/li/schemas-definitions/forgeschema:latest"
  stage: lint
  interruptible: true
  allow_failure: true
  script:
    - export PYCHARM_HOSTED=1
    - python testing/json/lint_json.py


# -----------------------------------------------------------
# Build


generate_artefacts:
generate_artefacts:
  image: "forge.etsi.org:5050/li/schemas-definitions/forgelib"
  image: "forge.etsi.org:5050/li/schemas-definitions/forgelib"
+31 −32
Original line number Original line Diff line number Diff line
@@ -34,4 +34,3 @@
    }
    }
  }
  }
}
}
  
 No newline at end of file
+196 −197
Original line number Original line Diff line number Diff line
@@ -207,4 +207,3 @@
    }
    }
  }
  }
}
}
  
 No newline at end of file
Loading