Skip to content
Snippets Groups Projects
Commit cea83217 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

CI without line13 since gitlab weird error

parent 4f4a1600
No related branches found
No related tags found
2 merge requests!11new release,!10new release
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
stages:
- license
- build_and_test
- deploy_demos
############ YAML ANCHORS ############
.preliminaries_template: &preliminaries_definition
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
## Run ssh-agent (inside the build environment)
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
# - echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts
- ssh-keyscan -H -p 2202 gitlab.iri.upc.edu >> $HOME/.ssh/known_hosts
# update apt
- apt-get update
# create ci_deps folder (if not exists)
- mkdir -pv ci_deps
.license_header_template: &license_header_definition
- cd $CI_PROJECT_DIR
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
# configure git
- export CI_NEW_BRANCH=ci_processing$RANDOM
- echo creating new temporary branch... $CI_NEW_BRANCH
- git config --global user.email "${CI_EMAIL}"
- git config --global user.name "${CI_USERNAME}"
- git checkout -b $CI_NEW_BRANCH # temporary branch
# license headers
- export CURRENT_YEAR=$( date +'%Y' )
- echo "current year:" ${CURRENT_YEAR}
- if [ -f license_header_${CURRENT_YEAR}.txt ]; then
# add license headers to new files
- echo "File license_header_${CURRENT_YEAR}.txt already exists. License headers are assumed to be updated. Adding headers to new files..."
- ./ci_deps/wolf/wolf_scripts/license_manager.sh --add --path=. --license-header=license_header_${CURRENT_YEAR}.txt --exclude=ci_deps
- else
# update license headers of all files
- export PREV_YEAR=$(( CURRENT_YEAR-1 ))
- echo "Creating new file license_header_${CURRENT_YEAR}.txt..."
- git mv license_header_${PREV_YEAR}.txt license_header_${CURRENT_YEAR}.txt
- sed -i "s/${PREV_YEAR}/${PREV_YEAR},${CURRENT_YEAR}/g" license_header_${CURRENT_YEAR}.txt
- ./ci_deps/wolf/wolf_scripts/license_manager.sh --update --path=. --license-header=license_header_${CURRENT_YEAR}.txt --exclude=ci_deps
- fi
# push changes (if any)
- if git commit -a -m "[skip ci] license headers added or modified" ; then
- git remote set-url --push origin "ssh://git@gitlab.iri.upc.edu:2202/${CI_PROJECT_PATH}.git"
- git push origin $CI_NEW_BRANCH:${CI_COMMIT_REF_NAME}
- else
- echo "No changes, nothing to commit!"
- fi
.install_wolf_template: &install_wolf_definition
- cd ${CI_PROJECT_DIR}/ci_deps
- if [ -d wolf ]; then
- echo "directory wolf exists"
- cd wolf
- git pull
- git checkout $WOLF_CORE_BRANCH
- else
- git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/wolf.git
- cd wolf
- git checkout $WOLF_CORE_BRANCH
- fi
- mkdir -pv build
- cd build
- cmake -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON ..
- make -j$(nproc)
- ctest -j$(nproc)
- make install
.build_and_test_template: &build_and_test_definition
- echo "todo"
############ LICENSE HEADERS ############
license_headers:
stage: license
image: labrobotica/wolf_deps:16.04
cache:
- key: wolf-xenial
paths:
- ci_deps/wolf/
except:
- master
before_script:
- *preliminaries_definition
- *install_wolf_definition
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
- *license_header_definition
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
############ UBUNTU 16.04 TEST ############
build_and_test:xenial:
stage: build_and_test
image: labrobotica/wolf_deps:16.04
cache:
- key: wolf-xenial
paths:
- ci_deps/wolf/
except:
- master
before_script:
- *preliminaries_definition
- *install_wolf_definition
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
- *build_and_test_definition
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
############ UBUNTU 18.04 TEST ############
build_and_test:bionic:
stage: build_and_test
image: labrobotica/wolf_deps:18.04
cache:
- key: wolf-bionic
paths:
- ci_deps/wolf/
except:
- master
before_script:
- *preliminaries_definition
- *install_wolf_definition
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
- *build_and_test_definition
############ DEPLOY DEMOS ############
deploy_imu:
stage: deploy_demos
variables:
WOLF_CORE_BRANCH: $WOLF_CORE_BRANCH
WOLF_IMU_BRANCH: $WOLF_IMU_BRANCH
WOLF_BODYDYNAMICS_BRANCH: $WOLF_BODYDYNAMICS_BRANCH
WOLF_VISION_BRANCH: $WOLF_VISION_BRANCH
WOLF_APRILTAG_BRANCH: $WOLF_APRILTAG_BRANCH
WOLF_GNSS_BRANCH: $WOLF_GNSS_BRANCH
WOLF_LASER_BRANCH: $WOLF_LASER_BRANCH
trigger:
project: mobile_robotics/wolf_projects/wolf_ros/wolf_ros_imu
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment