.gitlab-ci.yml 1.83 KB
Newer Older
jvoisin's avatar
jvoisin committed
1 2 3 4 5
image: debian:testing

stages:
  - linting
  - test
jfriedli's avatar
jfriedli committed
6
  - renovate
7
  - build_container
jvoisin's avatar
jvoisin committed
8

jfriedli's avatar
jfriedli committed
9 10 11 12
variables:
  CONTAINER_TEST_IMAGE: registry.0xacab.org/jvoisin/mat2-web:$CI_BUILD_REF_NAME
  CONTAINER_RELEASE_IMAGE: registry.0xacab.org/jvoisin/mat2-web:latest

jvoisin's avatar
jvoisin committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
pyflakes:
  stage: linting
  script:
  - apt-get -qqy update
  - apt-get -qqy install --no-install-recommends pyflakes3
  - pyflakes3 ./main.py

mypy:
  stage: linting
  script:
  - apt-get -qqy update
  - apt-get -qqy install --no-install-recommends python3-pip
  - pip3 install mypy
  - mypy --ignore-missing-imports main.py

jfriedli's avatar
jfriedli committed
28 29 30
bandit:
  image:
    name: $CI_REGISTRY/georg/mat2-ci-images:linting
jfriedli's avatar
jfriedli committed
31
  stage: linting
jfriedli's avatar
jfriedli committed
32 33 34
  script:
    - bandit -r ./matweb/ main.py

jvoisin's avatar
jvoisin committed
35 36
tests:debian:
  stage: test
jfriedli's avatar
jfriedli committed
37 38
  before_script:
    - apt update
jvoisin's avatar
jvoisin committed
39 40
  script:
  - apt-get -qqy update
jfriedli's avatar
jfriedli committed
41 42
  - apt-get -qqy install --no-install-recommends mat2 python3-flask python3-coverage python3-pip python3-setuptools
  - pip3 install wheel
jfriedli's avatar
jfriedli committed
43
  - pip3 install -r requirements.txt -r requirements-test.txt
jfriedli's avatar
jfriedli committed
44
  - python3-coverage run --branch --include main.py,matweb/*.py -m unittest discover -s test
jvoisin's avatar
jvoisin committed
45
  - python3-coverage report -m
jfriedli's avatar
jfriedli committed
46 47

build-docker:
48
  stage: build_container
jfriedli's avatar
jfriedli committed
49 50 51 52 53 54 55 56
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.production --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
  only:
    - tags
jfriedli's avatar
jfriedli committed
57 58 59 60 61 62 63 64 65 66 67
    - master

renovate:
  stage: renovate
  variables:
    RENOVATE_TOKEN: $GITLAB_API_TOKEN
  image:
    name: renovate/renovate:19
    entrypoint: ['']
  script:
    - node /usr/src/app/dist/renovate.js --platform gitlab --endpoint ${CI_API_V4_URL} --token ${GITLAB_API_TOKEN} ${CI_PROJECT_PATH}