Skip to content

CI Configuration Testing CI

Henning Wiedemann edited this page Sep 4, 2023 · 1 revision

Phobos CI for consistence Testing

You can use phobos-CI also to run consistency checks for every model - even though it is not processed by the phobos-CI pipeline.

Copy the following your repo and rename it to e.g. test_config.yml and adapt it to your needs. (see below)

pipeline:
  model:
    model_in_repo: urdf/$MODEL.urdf
    submechanisms_in_repo: submechanisms/submechanisms.yml  # needed but will be ignored when hyrdoynChecks are not used
    floating_base: False
    floatingbase_submechanisms_in_repo: None  # submechanisms/submechanisms_floatingbase.yml
    swing_my_robot: False
  test:
    tolerances:
      default: 0.01
      mass: 0.01
      rad: 0.03
      distance: 0.003
    compare_model:
      git: "https://git.hb.dfki.de/models-robots/$MODEL_GROUP/$MODEL_REPO"  # has to be https address for this repo
      branch: "master"
      model_in_repo: "urdf/$MODEL.urdf"
      submechanisms_in_repo: "submechanisms/submechanisms.yml"
    tests:
      - process_double_check
      - load_in_pybullet
      - compare_link_masses
      - compare_link_transformations
      - topological_self_consistency
      - compare_amount_joints
      - hyrodynChecks:
        - load_in_hyrodyn
        - compare_masses
        - compare_com
        - compare_torques
        - compare_link_positions: [] # List of Linknames
        - symmetry_check:
           - "A Left Link"
           - "The symmetric Right Link"
        - move_hyrodyn_model: 0.1
        - compare_com
        - compare_torques

Then you simply have to use the following config file to configure the pipeline in gitlab. See also the GitLab-CI-Documentation.

image: ${PHOBOS_CI_DOCKER_IMAGE}:20.04

stages:
  - test

variables:
  DOCKER_WORKSPACE: /opt/workspace
  WORKING_DIR: /opt/workspace/${CI_ROOT_PATH}

before_script:
  - echo "Testing model using phobos-CI."
  ## Let's see where we are
  - pwd
  - echo $CI_REPOSITORY_URL

  - mkdir -p ${CI_PROJECT_DIR}/public
  - git rev-parse HEAD > ${CI_PROJECT_DIR}/public/commit_ref.txt

  - export DEBIAN_FRONTEND=noninteractive

  - source ${DOCKER_WORKSPACE}/env.sh
  # ## Update package sets and directories to get freshly added models
  # - aup --config
  # - aup ${DOCKER_WORKSPACE}
  # ## comment the following lines to process faster and not change the working bootstrap from the buildserver
  # - amake ${DOCKER_WORKSPACE}
  # - autoproj envsh

  - source ${DOCKER_WORKSPACE}/env.sh
  ## list the installed python packages
  - python -m pip list

test:
  stage: test
  script:
    - phobos test_model test_config.yml  # 1>> ${CI_PROJECT_DIR}/public/test_log.txt 2>> ${CI_PROJECT_DIR}/public/test_err_log.txt
#  after_script:
#    - cat ${CI_PROJECT_DIR}/public/test_log.txt
#    - cat ${CI_PROJECT_DIR}/public/test_err_log.txt
  artifacts:
    when: always
    paths:
      - temp/
      - public/

As soon as you push these documents the GitLab-CI will start running and test your model. As with this initial commit nothing changed in the model it should pass all consistency checks. Only structural checks like symmetry might fail.

You'll get the test report in the pipelines job log.

Configuration

The configuration file is quite self-explanatory and is basically the same as the model definition file, but reduced to only the text section. For the available tests see here

It is recommended, that you give as compare model, the https(!)-URL of the repo you are working in. And as branch the master-branch. The pipeline will compare pushes on other branches always with the latest commit on master (or whatever you have configured as branch). When you commit to master the pipeline compares with the previous commit (git rev-parse HEAD^1).

Clone this wiki locally