summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: d7e53afe60e5c90290c239419572971f65fa6c59 (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
73
74
75
76
image: debian:testing

stages:
  - linting
  - test
  - renovate
  - build_container

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-venv python3-pip
  - python3 -m venv .venv
  - source .venv/bin/activate
  - pip install mypy
  - pip install -r requirements-test.txt
  - mypy --ignore-missing-imports --explicit-package-bases 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 build-essential libgirepository-2.0-dev mat2 python3-venv python3-dev python3-pip python3-setuptools libcairo2-dev pkg-config 
    - python3 -m venv .venv
    - source .venv/bin/activate
    - pip3 install -r requirements.txt -r requirements-test.txt
    - coverage run --branch --include ./main.py,matweb/*.py -m unittest discover -s test
    - coverage report -m
    - coverage xml
  coverage: '/TOTAL.*(\d\d%)/'
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml

build-docker:
  stage: build_container
  image:
    name: gcr.io/kaniko-project/executor:v1.24.0-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:39
    entrypoint: ['']
  only:
    - schedules
  script:
    - renovate --platform gitlab --endpoint ${CI_API_V4_URL} --token ${GITLAB_API_TOKEN} ${CI_PROJECT_PATH}