.gitlab-ci.yml
changeset 14 b1ad46aa2d16
child 19 270c209df927
equal deleted inserted replaced
13:a55722899cb5 14:b1ad46aa2d16
       
     1 image: python:3.5
       
     2 
       
     3 stages:
       
     4     - test
       
     5     - dist
       
     6     - quality
       
     7 
       
     8 cache:
       
     9     paths:
       
    10         - bin/
       
    11         - eggs/
       
    12         - parts/
       
    13 
       
    14 before_script:
       
    15     - export http_proxy=http://172.17.0.1:3128/
       
    16     - export HTTP_PROXY=http://172.17.0.1:3128/
       
    17     - export https_proxy=http://172.17.0.1:3128/
       
    18     - export HTTPS_PROXY=http://172.17.0.1:3128/
       
    19 
       
    20 bootstrap:
       
    21     stage: .pre
       
    22     script:
       
    23         - python3.5 bootstrap.py --buildout-version=2.12.0
       
    24         - ./bin/buildout
       
    25 
       
    26 test:
       
    27     stage: test
       
    28     script:
       
    29         - ./bin/test
       
    30 
       
    31 dist:
       
    32     stage: dist
       
    33     script:
       
    34         - ./bin/buildout setup setup.py clean --all sdist bdist_egg bdist_wheel
       
    35     artifacts:
       
    36         paths:
       
    37             - ./dist
       
    38 
       
    39 pylint:
       
    40     stage: quality
       
    41     allow_failure: true
       
    42     script:
       
    43         - pip install pylint-exit anybadge
       
    44         - mkdir ./pylint
       
    45         - ./bin/pylint src/pyams_utils/ | tee ./pylint/pylint.log || pylint-exit $?
       
    46         - PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
       
    47         - anybadge --label=Pylint --file=./pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
       
    48         - echo "Pylint score is $PYLINT_SCORE"
       
    49     artifacts:
       
    50         paths:
       
    51             - ./pylint/
       
    52 
       
    53 quality:
       
    54     stage: quality
       
    55     allow_failure: true
       
    56     image: docker:stable
       
    57     services:
       
    58         - docker:stable-dind
       
    59     variables:
       
    60         DOCKER_DRIVER: overlay2
       
    61         DOCKER_TLS_CERTDIR: ""
       
    62     script:
       
    63         - |
       
    64             if ! docker info &>/dev/null; then
       
    65               if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
       
    66                 export DOCKER_HOST='tcp://localhost:2375'
       
    67               fi
       
    68             fi
       
    69         - docker run
       
    70             --env SOURCE_CODE="$PWD"
       
    71             --volume "$PWD":/code
       
    72             --volume /var/run/docker.sock:/var/run/docker.sock
       
    73             "registry.gitlab.com/gitlab-org/security-products/codequality:12-0-stable" /code
       
    74     artifacts:
       
    75         reports:
       
    76             codequality: gl-code-quality-report.json
       
    77         expire_in: 1 week
       
    78     dependencies: []
       
    79     only:
       
    80         refs:
       
    81             - branches
       
    82             - tags
       
    83     except:
       
    84         variables:
       
    85             - $CODE_QUALITY_DISABLED