Commit 6c1ee3c2 authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

AT5-259: add .gital.ci.yml file

parent 57a56cee
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+71 −0
Original line number Diff line number Diff line
# GitLab CI in conjunction with GitLab Runner can use Docker Engine to test and build any application.
# Docker, when used with GitLab CI, runs each job in a separate and isolated container using the predefined image that is set up in .gitlab-ci.yml.
# In this case we use the latest python docker image to build and test this project.
image: nexus.engageska-portugal.pt/ska-docker/tango-builder:latest

variables:
  DOCKER_DRIVER: overlay2

services:
  - docker:dind

# cache is used to specify a list of files and directories which should be cached between jobs. You can only use paths that are within the project workspace.
# If cache is defined outside the scope of jobs, it means it is set globally and all jobs will use that definition
cache:
  paths:

# before_script is used to define the command that should be run before all jobs, including deploy jobs, but after the restoration of artifacts.
# This can be an array or a multi-line string.
before_script:
  - docker login --username $DOCKER_REGISTRY_USERNAME --password $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY_HOST

# The YAML file defines a set of jobs with constraints stating when they should be run.
# You can specify an unlimited number of jobs which are defined as top-level elements with an arbitrary name and always have to contain at least the script clause.
# In this case we have only the test job which produce an artifacts (it must be placed into a directory called "public")
# It is also specified that only the master branch will be subject of this job.

stages:
  - test        
  - publish
  - pages

test:
  tags:
    - docker-executor
  stage: test
  script:
    - cd ./csp-lmc-mid/docker
    - make build
    - make test
    - make lint
  artifacts:
    paths:
      - build

publish image:
  tags:
    - docker-executor
  stage: publish
  script:
    - make push
  when: manual

pages:
  stage: pages
  dependencies: 
     - test
  script:
   - mkdir -p .public/reports  
   - cp build/csp*.* .public
   - cp -r build/csp_master_htmlcov/* .public
   - cp -r build/csp_subarray_htmlcov/* .public
   - cp temp/ci-metrics-mock.json ci-metrics.json
   - cp build/lint_output.xml .public/reports
   - cp build/csp_master_coverage.xml .public/reports
   - cp build/csp_subarray_coverage.xml .public/reports
   - mv .public public
   - curl -s https://gitlab.com/ska-telescope/ci-metrics-utilities/raw/master/scripts/ci-badges-func.sh | sh
  artifacts:
    paths:
      - public
    expire_in: 30 days