summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 30708fc84523366bb1f8d515eba7b43144beac5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
image: debian:testing

stages:
  - linting
  - test
  - renovate
  - build_container

variables:
  CONTAINER_TEST_IMAGE: registry.0xacab.org/jvoisin/mat2-web:$CI_BUILD_REF_NAME
  CONTAINER_RELEASE_IMAGE: registry.0xacab.org/jvoisin/mat2-web:latest

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
  - pip3 install -r requirements-test.txt
  - mypy --ignore-missing-imports matweb main.py

bandit:
  image:
    name: $CI_REGISTRY/georg/mat2-ci-images:linting
  stage: linting
  script:
    - bandit -r ./matweb/ main.py

tests:debian:
  stage: test
  before_script:
    - apt update
  script:
    - apt-get -qqy update
    - apt-get -qqy install --no-install-recommends mat2 python3-flask python3-coverage python3-pip python3-setuptools
    - pip3 install wheel
    - pip3 install -r requirements.txt -r requirements-test.txt
    - python3-coverage run --branch --include main.py,matweb/*.py -m unittest discover -s test
    - python3-coverage report -m
    - python3-coverage xml
  artifacts:
    reports:
      cobertura: coverage.xml

build-docker:
  stage: build_container
  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
    - master

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