.gitlab-ci.yml 1.63 KB
Newer Older
Erick Hitter's avatar
Erick Hitter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
image: containers.ethitter.com:443/docker/images/golang:latest

variables:
  REPO_NAME: git.ethitter.com/debian/gitlab-runner-do-monitor

cache:
  paths:
    - /apt-cache
    - $GOPATH/src/github.com
    - $GOPATH/src/golang.org
    - $GOPATH/src/google.golang.org
    - $GOPATH/src/gopkg.in

stages:
  - test
  - build

Erick Hitter's avatar
Erick Hitter committed
18 19 20 21 22
before_script:
  - mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
  - cp -R $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
  - cd $GOPATH/src/$REPO_NAME
  - cp config-sample.json config.json
Erick Hitter's avatar
Erick Hitter committed
23

Erick Hitter's avatar
Erick Hitter committed
24
  - export CC=clang-5.0
Erick Hitter's avatar
Erick Hitter committed
25

26
  - make dep
Erick Hitter's avatar
Erick Hitter committed
27 28 29 30

unit_tests:
  stage: test
  script:
31
    - make test
Erick Hitter's avatar
Erick Hitter committed
32 33 34 35

race_detector:
  stage: test
  script:
36
    - make race
Erick Hitter's avatar
Erick Hitter committed
37 38 39 40

memory_sanitizer:
  stage: test
  script:
41
    - make msan
Erick Hitter's avatar
Erick Hitter committed
42 43 44 45

code_coverage:
  stage: test
  script:
46
    - make coverage
Erick Hitter's avatar
Erick Hitter committed
47 48 49 50

code_coverage_report:
  stage: test
  script:
51
    - make coverhtml
Erick Hitter's avatar
Erick Hitter committed
52 53 54 55 56 57
  only:
  - master

lint_code:
  stage: test
  script:
58
    - make lint
Erick Hitter's avatar
Erick Hitter committed
59 60 61 62

build:
  stage: build
  script:
63
    - make
Erick Hitter's avatar
Erick Hitter committed
64 65
  artifacts:
    paths:
Erick Hitter's avatar
Erick Hitter committed
66 67 68 69 70 71 72 73 74 75
      - gitlab-runner-do-monitor/

# GitLab CI tools: https://docs.gitlab.com/ee/ci/examples/README.html
code_quality:
  image: docker:stable
  variables:
    DOCKER_DRIVER: overlay2
  allow_failure: true
  services:
    - docker:stable-dind
76
  before_script:
Erick Hitter's avatar
Erick Hitter committed
77
    - echo "Skipping before_script actions"
Erick Hitter's avatar
Erick Hitter committed
78 79 80 81 82 83 84 85 86
  script:
    - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
    - docker run
        --env SOURCE_CODE="$PWD"
        --volume "$PWD":/code
        --volume /var/run/docker.sock:/var/run/docker.sock
        "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
  artifacts:
    paths: [gl-code-quality-report.json]