.gitlab-ci.yml 6.15 KB
Newer Older
Tomasz Kucner's avatar
Tomasz Kucner committed
1 2 3
stages:
  - dev-build
  - night-build
Tomasz Kucner's avatar
Tomasz Kucner committed
4
  - night-build-publish
Tomasz Kucner's avatar
Tomasz Kucner committed
5
  - release-build
Tomasz Kucner's avatar
Tomasz Kucner committed
6
  - release-build-publish
Tomasz Kucner's avatar
Tomasz Kucner committed
7

Tomasz Kucner's avatar
Tomasz Kucner committed
8
###################################################################      
Tomasz Kucner's avatar
Tomasz Kucner committed
9
# Ubuntu 16.04
10
ubuntu-xenial-test:
Tomasz Kucner's avatar
Tomasz Kucner committed
11 12 13 14
  image: ubuntu:xenial
  variables:
    CI_ROS_DISTRO: kinetic
    UBUNTU_DISTRO: xenial
Tomasz Kucner's avatar
Tomasz Kucner committed
15 16
    GIT_STRATEGY: clone
    
Tomasz Kucner's avatar
Tomasz Kucner committed
17 18 19
  before_script:
    - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
    - apt-get update
Tomasz Kucner's avatar
Tomasz Kucner committed
20
    - apt-get install -qq -y apt-transport-https sed wget unzip > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
21
    - source .gitlab-ci/prepare.sh
22
    - chmod +x setup.sh
Tomasz Kucner's avatar
Tomasz Kucner committed
23
    - ./setup.sh $UBUNTU_DISTRO $CI_ROS_DISTRO > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
24
    - setup_apt ${UBUNTU_DISTRO}
Tomasz Kucner's avatar
Tomasz Kucner committed
25 26
    - apt-get install -qq -y python-catkin-tools > /dev/null
    - rosdep update 2> /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
27
    - add_aass_yaml
Tomasz Kucner's avatar
Tomasz Kucner committed
28 29
    - rosdep install --from-paths . -i -y -r --rosdistro $CI_ROS_DISTRO 2> /dev/null

Tomasz Kucner's avatar
Tomasz Kucner committed
30

Tomasz Kucner's avatar
Tomasz Kucner committed
31
  stage: dev-build
Tomasz Kucner's avatar
Tomasz Kucner committed
32 33 34 35 36 37 38 39 40 41
  script:
    - old_dir=`pwd`
    - mkdir -p /tmp/src
    - cp  -r * /tmp/src/
    - cd /tmp/
    - source /opt/ros/${CI_ROS_DISTRO}/setup.sh
    - catkin init
    - catkin build
    - cd $old_dir
    - rm -rf /tmp/src
Tomasz Kucner's avatar
Tomasz Kucner committed
42

Tomasz Kucner's avatar
Tomasz Kucner committed
43
###################################################################
Tomasz Kucner's avatar
Tomasz Kucner committed
44
# Ubuntu 16.04 debian package generation
45
ubuntu-xenial-build-package-nightbuild:
Tomasz Kucner's avatar
Tomasz Kucner committed
46 47 48 49
  image: ubuntu:xenial
  variables:
    CI_ROS_DISTRO: kinetic
    UBUNTU_DISTRO: xenial
Tomasz Kucner's avatar
Tomasz Kucner committed
50 51
    GIT_STRATEGY: clone
    
Tomasz Kucner's avatar
Tomasz Kucner committed
52 53 54 55 56
  before_script:
    - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
    - echo $CI_ROS_DISTRO
    - echo ${CI_ROS_DISTRO}
    - apt-get update
Tomasz Kucner's avatar
Tomasz Kucner committed
57
    - apt-get install -qq -y apt-transport-https sed wget unzip > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
58
    - source .gitlab-ci/prepare.sh
59
    - chmod +x setup.sh
Tomasz Kucner's avatar
Tomasz Kucner committed
60
    - ./setup.sh $UBUNTU_DISTRO $CI_ROS_DISTRO > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
61
    - setup_apt ${UBUNTU_DISTRO}
Tomasz Kucner's avatar
Tomasz Kucner committed
62
    - apt-get install -q -y python-bloom devscripts debhelper > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
63
    - apt-get install -f -y  > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
64
    - rosdep update 2> /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
65
    - add_aass_yaml
Tomasz Kucner's avatar
Tomasz Kucner committed
66 67
    - rosdep install --from-paths . -i -y -r --rosdistro $CI_ROS_DISTRO  2> /dev/null

Tomasz Kucner's avatar
Tomasz Kucner committed
68

Tomasz Kucner's avatar
Tomasz Kucner committed
69
  stage: night-build
Tomasz Kucner's avatar
Tomasz Kucner committed
70 71 72 73 74 75 76 77
  script:
    - ls *
    - rm -rf build
    - source .gitlab-ci/release.sh
    - show_info
    - mkdir .build
    - release_package
    - mv .build build
78
    
79
  when: on_success
Tomasz Kucner's avatar
Tomasz Kucner committed
80
# The files which are to be made available in GitLab
Tomasz Kucner's avatar
Tomasz Kucner committed
81 82 83
  artifacts:
    paths:
      - build/*
Tomasz Kucner's avatar
Tomasz Kucner committed
84

Tomasz Kucner's avatar
Tomasz Kucner committed
85 86 87 88 89 90 91 92 93

  
###################################################################
# put code to public reposiotry - night build
git-push-public-night-build:
  image: ubuntu:xenial
  variables:
    CI_ROS_DISTRO: kinetic
    UBUNTU_DISTRO: xenial
Tomasz Kucner's avatar
Tomasz Kucner committed
94
    GIT_STRATEGY: clone
Tomasz Kucner's avatar
Tomasz Kucner committed
95
    PUBLIC_REPO: git@gitsvn-nt.oru.se:software/ndt_core_public.git
Tomasz Kucner's avatar
Tomasz Kucner committed
96 97 98 99 100 101
    
  stage: night-build-publish
  
  when: on_success
  except:
    - tags
Tomasz Kucner's avatar
Tomasz Kucner committed
102 103
  only:
    - branches@software/ndt_core
Tomasz Kucner's avatar
Tomasz Kucner committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
  
  before_script:
   - apt-get update
   - apt-get install -f -y  > /dev/null
   - apt-get install -y git > /dev/null

  script:
    # Install ssh-agent through openssh-client if not present
    - 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )'
    # Add the private key to this user
    - eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY") && mkdir -p ~/.ssh
    # Docker specific settings
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    # Config git to avoid first usage questions. Set the identity
    - git config --global user.email "gitlab-ci@oru.se" && git config --global user.name "gitlab-ci"
    #
    # Do Git stuff, for example:
    #
Tomasz Kucner's avatar
Tomasz Kucner committed
122
    - 'git config remote.public.url > /dev/null && echo "git public" || ( git remote add public $PUBLIC_REPO )'
Tomasz Kucner's avatar
Tomasz Kucner committed
123 124 125 126 127
    - git push public master
    # - git push -u public --tags

  
###################################################################
Tomasz Kucner's avatar
Tomasz Kucner committed
128 129 130 131 132 133
# Ubuntu 16.04 debian package generation
ubuntu-xenial-build-package-release:
  image: ubuntu:xenial
  variables:
    CI_ROS_DISTRO: kinetic
    UBUNTU_DISTRO: xenial
Tomasz Kucner's avatar
Tomasz Kucner committed
134 135
    GIT_STRATEGY: clone
    
Tomasz Kucner's avatar
Tomasz Kucner committed
136 137 138 139 140 141 142 143 144 145 146
  before_script:
    - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
    - echo $CI_ROS_DISTRO
    - echo ${CI_ROS_DISTRO}
    - apt-get update
    - apt-get install -qq -y apt-transport-https sed wget unzip > /dev/null
    - source .gitlab-ci/prepare.sh
    - chmod +x setup.sh
    - ./setup.sh $UBUNTU_DISTRO $CI_ROS_DISTRO > /dev/null
    - setup_apt ${UBUNTU_DISTRO}
    - apt-get install -q -y python-bloom devscripts debhelper > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
147
    - apt-get install -f -y  > /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
148
    - rosdep update 2> /dev/null
Tomasz Kucner's avatar
Tomasz Kucner committed
149
    - add_aass_yaml
Tomasz Kucner's avatar
Tomasz Kucner committed
150 151
    - rosdep install --from-paths . -i -y -r --rosdistro $CI_ROS_DISTRO  2> /dev/null

Tomasz Kucner's avatar
Tomasz Kucner committed
152 153 154 155 156 157 158 159 160 161 162 163 164

  stage: release-build
  script:
    - ls *
    - rm -rf build
    - source .gitlab-ci/release.sh
    - show_info
    - mkdir .build
    - release_package
    - mv .build build
    
  only:
    - tags
165
  when: on_success
Tomasz Kucner's avatar
Tomasz Kucner committed
166 167 168 169 170
  
# The files which are to be made available in GitLab
  artifacts:
    paths:
      - build/*
Tomasz Kucner's avatar
Tomasz Kucner committed
171 172 173 174 175 176 177
###################################################################
# put code to public reposiotry - release build
git-push-public-release-build:
  image: ubuntu:xenial
  variables:
    CI_ROS_DISTRO: kinetic
    UBUNTU_DISTRO: xenial
Tomasz Kucner's avatar
Tomasz Kucner committed
178
    GIT_STRATEGY: clone
Tomasz Kucner's avatar
Tomasz Kucner committed
179
    PUBLIC_REPO: git@gitsvn-nt.oru.se:software/ndt_core_public.git
Tomasz Kucner's avatar
Tomasz Kucner committed
180 181 182 183 184
    
  stage: release-build-publish
  
  when: on_success
  only:
Tomasz Kucner's avatar
Tomasz Kucner committed
185
    - tags@software/ndt_core
Tomasz Kucner's avatar
Tomasz Kucner committed
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
  
  before_script:
   - apt-get update
   - apt-get install -f -y  > /dev/null
   - apt-get install -y git > /dev/null


  script:
    # Install ssh-agent through openssh-client if not present
    - 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )'
    # Add the private key to this user
    - eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY") && mkdir -p ~/.ssh
    # Docker specific settings
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    # Config git to avoid first usage questions. Set the identity
    - git config --global user.email "gitlab-ci@oru.se" && git config --global user.name "gitlab-ci"
    #
    # Do Git stuff, for example:
    #
Tomasz Kucner's avatar
Tomasz Kucner committed
205
    - ' git config remote.public.url > /dev/null && echo "git public" || ( git remote add public $PUBLIC_REPO ) '
Tomasz Kucner's avatar
Tomasz Kucner committed
206 207
    # - git push -u public --all
    - git push public --tags
Tomasz Kucner's avatar
Tomasz Kucner committed
208