.gitlab-ci.yml 2.42 KB
Newer Older
georg's avatar
georg committed
1 2
variables:
  CONTAINER_REGISTRY: $CI_REGISTRY/georg/mat2-ci-images
jvoisin's avatar
jvoisin committed
3

jvoisin's avatar
jvoisin committed
4 5 6 7
stages:
  - linting
  - test

8 9 10 11 12
.prepare_env: &prepare_env
  before_script:  # This is needed to not run the testsuite as root
    - useradd --home-dir ${CI_PROJECT_DIR} mat2
    - chown -R mat2 .

georg's avatar
georg committed
13
linting:bandit:
georg's avatar
georg committed
14
  image: $CONTAINER_REGISTRY:linting 
jvoisin's avatar
jvoisin committed
15
  stage: linting
16
  script:  # TODO: remove B405 and B314
georg's avatar
georg committed
17 18
    - bandit ./mat2 --format txt --skip B101
    - bandit -r ./nautilus/ --format txt --skip B101
jvoisin's avatar
jvoisin committed
19
    - bandit -r ./libmat2 --format txt --skip B101,B404,B603,B405,B314,B108,B311
jvoisin's avatar
jvoisin committed
20

21 22 23 24 25 26 27 28 29
linting:codespell:
  image: $CONTAINER_REGISTRY:linting
  stage: linting
  script:
    # Run codespell to check for spelling errors; ignore errors about binary
    # files, use a config with ignored words and exclude the git directory,
    # which might contain false positives
    - codespell -q 2 -I utils/ci/codespell/ignored_words.txt -S .git
  
georg's avatar
georg committed
30
linting:pylint:
georg's avatar
georg committed
31
  image: $CONTAINER_REGISTRY:linting
jvoisin's avatar
jvoisin committed
32 33
  stage: linting
  script:
georg's avatar
georg committed
34
    - pylint --disable=no-else-return,no-else-raise,no-else-continue,unnecessary-comprehension --extension-pkg-whitelist=cairo,gi ./libmat2 ./mat2
georg's avatar
georg committed
35
    # Once nautilus-python is in Debian, decomment it form the line below
georg's avatar
georg committed
36
    - pylint --disable=no-else-return,no-else-raise,no-else-continue,unnecessary-comprehension --extension-pkg-whitelist=Nautilus,GObject,Gtk,Gio,GLib,gi ./nautilus/mat2.py
jvoisin's avatar
jvoisin committed
37

georg's avatar
georg committed
38
linting:pyflakes:
georg's avatar
georg committed
39
  image: $CONTAINER_REGISTRY:linting
jvoisin's avatar
jvoisin committed
40 41
  stage: linting
  script:
georg's avatar
georg committed
42
    - pyflakes3 ./libmat2 ./mat2 ./tests/ ./nautilus
jvoisin's avatar
jvoisin committed
43

georg's avatar
georg committed
44
linting:mypy:
georg's avatar
georg committed
45
  image: $CONTAINER_REGISTRY:linting
46 47
  stage: linting
  script:
georg's avatar
georg committed
48
    - mypy --ignore-missing-imports mat2 libmat2/*.py ./nautilus/mat2.py
49

georg's avatar
georg committed
50 51 52 53
tests:archlinux:
  image: $CONTAINER_REGISTRY:archlinux
  stage: test
  script:
54
    - python3 -m unittest discover -v
georg's avatar
georg committed
55
  
jvoisin's avatar
jvoisin committed
56
tests:debian:
georg's avatar
georg committed
57
  image: $CONTAINER_REGISTRY:debian
jvoisin's avatar
jvoisin committed
58
  stage: test
jvoisin's avatar
jvoisin committed
59
  script:
georg's avatar
georg committed
60
    - apt-get -qqy purge bubblewrap
61
    - python3 -m unittest discover -v
62 63

tests:debian_with_bubblewrap:
georg's avatar
georg committed
64
  image: $CONTAINER_REGISTRY:debian
65
  stage: test
66
  <<: *prepare_env
67
  script:
68 69
    - su - mat2 -c "python3-coverage run --branch -m unittest discover -s tests/"
    - su - mat2 -c "python3-coverage report --fail-under=100 -m --include 'libmat2/*'"
jvoisin's avatar
jvoisin committed
70 71

tests:fedora:
georg's avatar
georg committed
72
  image: $CONTAINER_REGISTRY:fedora
jvoisin's avatar
jvoisin committed
73 74
  stage: test
  script:
75
    - python3 -m unittest discover -v
jvoisin's avatar
jvoisin committed
76

georg's avatar
georg committed
77 78
tests:gentoo:
  image: $CONTAINER_REGISTRY:gentoo
jvoisin's avatar
jvoisin committed
79
  stage: test
80
  <<: *prepare_env
jvoisin's avatar
jvoisin committed
81
  script:
82
    - su - mat2 -c "python3 -m unittest discover -v"