Commit 2d6ff717 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Split validation and generation of docx in validate.sh

parent b0448e86
Loading
Loading
Loading
Loading
Loading
+11 −3
Changes for api-tests/.gitlab-ci.yml: 11 added lines, 3 removed lines.
Original line number Original line Diff line number Diff line
@@ -9,10 +9,8 @@


workflow:
workflow:
  rules:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH
    - if: $CI_COMMIT_BRANCH
    - if: $CI_COMMIT_TAG
    
    
variables:
variables:
  LOGFILE_YANG: "yang-validation.txt"
  LOGFILE_YANG: "yang-validation.txt"
@@ -21,6 +19,7 @@ variables:


stages:
stages:
  - validation
  - validation
  - generation
  - trigger
  - trigger
        
        
Validate API Robot Test Suite:
Validate API Robot Test Suite:
@@ -28,6 +27,15 @@ Validate API Robot Test Suite:
  script:
  script:
    - echo 'Validate API Robot Test Suite'
    - echo 'Validate API Robot Test Suite'
    - docker run -v "$(pwd):/home/etsi/dev/robot" stf583-rf-validation:miguel "bash" -c  "/home/etsi/dev/scripts/validate.sh $CI_COMMIT_BRANCH"
    - docker run -v "$(pwd):/home/etsi/dev/robot" stf583-rf-validation:miguel "bash" -c  "/home/etsi/dev/scripts/validate.sh $CI_COMMIT_BRANCH"
      
Generate API Robot Test Suite docx:
  stage: generation
  only:
    - tags
  script:
    - echo 'Generate API Robot Test Suite docx'
    - tagTargetBranch=$(git branch -a --contains tags/$CI_COMMIT_REF_NAME | tail -n 1)
    - docker run -v "$(pwd):/home/etsi/dev/robot" -u $(id -u):$(id -g) stf583-rf-validation:miguel "bash" -c  "/home/etsi/dev/scripts/generate.sh $tagTargetBranch"
  artifacts:
  artifacts:
    when: on_success
    when: on_success
    paths:
    paths:
+24 −0
Changes for api-tests/scripts/generate.sh: 24 added lines, 0 removed lines.
Original line number Original line Diff line number Diff line
#!/bin/bash
#
# Generate docx document for the Robot test suite

cd /home/etsi/dev/robot/ 

echo "Using git branch $1"

mkdir -p /home/etsi/dev/robot/build
cd /home/etsi/dev/robot/build
rm -r -v *

if [[ $1 =~ ^(remotes\/){0,1}(origin\/){0,1}([0-9]{1}(\.[0-9]){2}){1}-dev$ || $1 =~ ^(remotes\/){0,1}(origin\/){0,1}([0-9]{1})(\.[0-9]){2,10}$ || $1 =~ ^(remotes\/){0,1}(origin\/){0,1}master$ || $1 =~ ^(remotes\/){0,1}(origin\/){0,1}Release-([0-9]{1})$ ]]; then

	echo "++++ Try to generate docs for branch $1"
	cd /home/etsi/dev/robot2doc/robot2doc

	python3 create_sols.py ../../robot 'local' ../../robot/build
	res2=$?
else res2=0
    echo "++++ Not generating docs for branch $1"
fi

exit $res && $res2
+1 −18
Changes for api-tests/scripts/validate.sh: 1 added line, 18 removed lines.
Original line number Original line Diff line number Diff line
@@ -17,21 +17,4 @@ for i in */*/*.robot ; do
    fi
    fi
done
done


echo "Using git branch $1"
exit $res

mkdir -p /home/etsi/dev/robot/build
cd /home/etsi/dev/robot/build
rm -r -v *

if [[ $1 =~ ^(origin\/){0,1}([0-9]{1}(\.[0-9]){2}){1}-dev$ || $1 =~ ^(origin\/){0,1}([0-9]{1})(\.[0-9]){2,10}$ || $1 =~ ^(origin\/){0,1}master$ || $1 =~ ^(origin\/){0,1}Release-([0-9]{1})$ ]]; then

	echo "++++ Try to generate docs for branch $1"
	cd /home/etsi/dev/robot2doc/robot2doc

	python3 create_sols.py ../../robot 'local' ../../robot/build
	res2=$?
else res2=0
    echo "++++ Not generating docs for branch $1"
fi

exit $res && $res2