.gitlab-ci.yml 3.17 KB
Newer Older
1
image: registry.gitlab.com/jlack/rdl:ci-docker-melodic
Jordan Lack's avatar
Jordan Lack committed
2 3 4

variables:
  WS_NAME: "rdl_ws"
5

Jordan Lack's avatar
Jordan Lack committed
6 7
before_script:
  - apt-get update -qq -y
8
  - apt-get upgrade -y
Jordan Lack's avatar
Jordan Lack committed
9 10 11
  - rosdep update

stages:
Jordan Lack's avatar
Jordan Lack committed
12 13
  - test
  - analyze
14
  - pages
Jordan Lack's avatar
Jordan Lack committed
15

Jordan Lack's avatar
Jordan Lack committed
16 17
build_and_test:
  stage: test
Jordan Lack's avatar
Jordan Lack committed
18
  retry: 1
Jordan Lack's avatar
Jordan Lack committed
19
  script:
20
    - echo $CI_PROJECT_NAME
Jordan Lack's avatar
Jordan Lack committed
21
    - mkdir -p $WS_NAME/src && cd $WS_NAME/src
22
    - git clone -b ${CI_COMMIT_REF_NAME} ${CI_REPOSITORY_URL}
Jordan Lack's avatar
Jordan Lack committed
23
    - cd .. && rosdep install --from-paths src -i -y --as-root apt:false
24
    - catkin config --init --mkdirs --install --extend /opt/ros/$ROS_DISTRO
Jordan Lack's avatar
Jordan Lack committed
25
    - catkin build
Jordan Lack's avatar
Jordan Lack committed
26
    - catkin run_tests
27
    - catkin_test_results build/
28 29

    # Check formatting
Jordan Lack's avatar
Jordan Lack committed
30 31
    - catkin build --no-deps rdl_dynamics --make-args format_code_rdl_dynamics --
    - catkin build --no-deps rdl_urdfreader --make-args format_code_rdl_urdfreader --
32
    - catkin build --no-deps rdl_ros_tools --make-args format_code_rdl_ros_tools --
33
    - cd src/$CI_PROJECT_NAME && if git diff --quiet --exit-code; then printf "\033[1;32mCode formatting test passed\033[0m\n"; else printf "\033[1;31mYour code requires formatting\033[0m\n" && exit 1; fi
Jordan Lack's avatar
Jordan Lack committed
34 35
  artifacts:
    paths:
36
    - $WS_NAME/
Jordan Lack's avatar
Jordan Lack committed
37 38
    expire_in: 1 day

39
coverage_rdl_urdfreader:
Jordan Lack's avatar
Jordan Lack committed
40
  stage: analyze
41
  dependencies:
Jordan Lack's avatar
Jordan Lack committed
42
  - build_and_test
43 44 45 46 47
  script:
  - cd $WS_NAME && rosdep install --from-paths src -i -y --as-root apt:false
  - catkin build
  - catkin run_tests --no-deps rdl_urdfreader -DCMAKE_BUILD_TYPE=Coverage --make-args run_coverage_rdl_urdfreader
  - gcovr -r .
Jordan Lack's avatar
Jordan Lack committed
48
  - mv build/rdl_urdfreader/coverage $CI_PROJECT_DIR/rdl_urdfreader_coverage
Jordan Lack's avatar
Jordan Lack committed
49
  artifacts:
50
    name: rdl_urdfreader_coverage
Jordan Lack's avatar
Jordan Lack committed
51
    paths:
52
    - $CI_PROJECT_DIR/rdl_urdfreader_coverage/
Jordan Lack's avatar
Jordan Lack committed
53

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
coverage_rdl_ros_tools:
  stage: analyze
  dependencies:
  - build_and_test
  script:
  - cd $WS_NAME && rosdep install --from-paths src -i -y --as-root apt:false
  - catkin build
  - catkin run_tests --no-deps rdl_ros_tools -DCMAKE_BUILD_TYPE=Coverage --make-args run_coverage_rdl_ros_tools
  - gcovr -r .
  - mv build/rdl_ros_tools/coverage $CI_PROJECT_DIR/rdl_ros_tools_coverage
  artifacts:
    name: rdl_ros_tools_coverage
    paths:
    - $CI_PROJECT_DIR/rdl_ros_tools_coverage/

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
coverage_rdl_dynamics:
  stage: analyze
  dependencies:
  - build_and_test
  script:
  - cd $WS_NAME && rosdep install --from-paths src -i -y --as-root apt:false
  - catkin build
  - catkin run_tests --no-deps rdl_dynamics -DCMAKE_BUILD_TYPE=Coverage --make-args run_coverage_rdl_dynamics
  - gcovr -r .
  - mv build/rdl_dynamics/coverage $CI_PROJECT_DIR/rdl_dynamics_coverage
  artifacts:
    name: rdl_dynamics_coverage
    paths:
    - $CI_PROJECT_DIR/rdl_dynamics_coverage/

Jordan Lack's avatar
Jordan Lack committed
84
pages:
85
  stage: pages
Jordan Lack's avatar
Jordan Lack committed
86 87
  dependencies:
  - build_and_test
Jordan Lack's avatar
Jordan Lack committed
88 89
  - coverage_rdl_urdfreader
  - coverage_rdl_dynamics
Jordan Lack's avatar
Jordan Lack committed
90
  - coverage_rdl_ros_tools
Jordan Lack's avatar
Jordan Lack committed
91
  script:
Jordan Lack's avatar
Jordan Lack committed
92
  - cd $WS_NAME
Jordan Lack's avatar
Jordan Lack committed
93 94
  - rosdep install --from-paths src -i -y --as-root apt:false
  - cd src/$CI_PROJECT_NAME && doxygen Doxyfile
Jordan Lack's avatar
Jordan Lack committed
95
  - cd $CI_PROJECT_DIR
96
  - mkdir public/
Jordan Lack's avatar
Jordan Lack committed
97
  - mv $WS_NAME/src/$CI_PROJECT_NAME/doxygen/ public/doxygen
98 99
  - mv rdl_dynamics_coverage/ public/rdl-dynamics-coverage
  - mv rdl_urdfreader_coverage/ public/rdl-urdfreader-coverage
Jordan Lack's avatar
Jordan Lack committed
100
  - mv rdl_ros_tools_coverage/ public/rdl-ros-tools-coverage
Jordan Lack's avatar
Jordan Lack committed
101 102
  artifacts:
    paths:
Jordan Lack's avatar
Jordan Lack committed
103
    - public/
Jordan Lack's avatar
Jordan Lack committed
104 105
  only: 
  - master