cache:
  key: "${CI_JOB_NAME}" # https://docs.gitlab.com/ee/ci/caching/#sharing-caches-across-different-branches
  paths:
    - ccache

lint:
  tags: [python-ci]
  image: python:3.8-buster
  allow_failure: true
  script:
    - pip3 -q install flake8 pep8-naming typing
    - python3 -m flake8

test_packages:
  tags: [industrial-ci]
  image: docker:git
  services:
  - docker:dind
  variables:
    ADDITIONAL_DEBS: cython3 wget
    CATKIN_LINT: 'true'
    DOCKER_IMAGE: zoeyc/cse478:latest
    DOCKER_TLS_CERTDIR: ""
    UPSTREAM_WORKSPACE: '.gitlab/.rosinstall'
    AFTER_INSTALL_TARGET_DEPENDENCIES: '(cd ../; git clone https://github.com/prl-mushr/range_libc.git; cd range_libc; cd pywrapper; python3 setup.py install);'
    BASEDIR: ${CI_PROJECT_DIR}/.workspaces
    TMPDIR: ${CI_PROJECT_DIR}.tmp
    CCACHE_DIR: ${CI_PROJECT_DIR}/ccache
    ROS_DISTRO: noetic
  before_script:
  - apk add --update bash coreutils tar openssh-client wget xz
  - wget -q https://courses.cs.washington.edu/courses/cse478/data/localization_bags.tar.xz --directory-prefix localization/bags/
  - tar -xvf localization/bags/localization_bags.tar.xz --directory localization
  - rm localization/bags/localization_bags.tar.xz
  - git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci .industrial_ci -b master
  script: .industrial_ci/gitlab.sh TARGET_WORKSPACE="."
  artifacts:
    when: always
    reports:
      junit: ${BASEDIR}/**/test_results/**/*.xml