Skip to content
Snippets Groups Projects
Forked from Florian Leander Singer / RobotAPI
100 commits behind the upstream repository.
.gitlab-ci.yml 4.28 KiB
stages:
  - build-and-test
  - deploy
  - post-deploy-test


.build-and-test:

  cache:
    # https://docs.gitlab.com/ee/ci/caching/#share-caches-across-jobs-in-different-branches
    key: one-key-to-rule-them-all
    paths:
      - .apt
      - .ccache

  before_script:
    # Apt cache configuration.
    - rm -rf /var/cache/apt/archives || true
    - rm -f /etc/apt/apt.conf.d/docker-clean  # Remove docker-clean script to avoid cache deletion.
    - mkdir .apt || true
    - ln -s "$CI_PROJECT_DIR/.apt" /var/cache/apt/archives

    # Update apt info.
    - apt-get update

    # Ccache configuration and introspection.
    - apt-get install ccache --yes
    - ccache --set-config=cache_dir="$CI_PROJECT_DIR/.ccache"
    - ccache --max-size=20G
    - ccache --show-stats

    # Activate Axii.
    - source /axii/scripts/install_axii.sh
    - _axii_auto_env_refresh

  script:
    - echo "ArmarX Workspace = '$ARMARX_WORKSPACE'"

    # Use workspace configuration from project.
    - cp "$CI_PROJECT_DIR/.gitlab/ci/armarx-workspace.json" "$ARMARX_WORKSPACE/armarx-workspace.json"
    - cat "$ARMARX_WORKSPACE/armarx-workspace.json"

    - axii workspace env
    - _axii_auto_env_refresh

    - echo "Workspace information:"
    - axii workspace list-modules
    - axii workspace list-modules --deps
    - axii workspace info

    - export PROJECT_MODULE="armarx/RobotAPI"
    - export PROJECT_PATH_IN_WORKSPACE="$armarx__RobotAPI__PATH"

    # Symlink project directory into Axii workspace.
    - mkdir -p "$(dirname $PROJECT_PATH_IN_WORKSPACE)"
    - ln -s "$CI_PROJECT_DIR" "$PROJECT_PATH_IN_WORKSPACE"

    # Fix "CMake Error in CMakeLists.txt: Imported target "VirtualRobot" includes non-existent path "/usr/lib/include"
    # (caused by at least dmp)
    - mkdir -p /usr/lib/include

    # Upgrade.
    - axii workspace system --accept-apt-install
    - axii workspace update --prefer-https
    - axii workspace upgrade -m "$PROJECT_MODULE"

    - ccache --show-stats

    # Test.
    # ToDo: Add and use `axii ws test -m "$PROJECT_MODULE"`